Fix #50: highlight for wrapped lines

This commit is contained in:
Roi Martin 2016-05-17 22:40:24 +02:00
parent 490199421a
commit 0707386452
1 changed files with 16 additions and 1 deletions

17
view.go
View File

@ -104,8 +104,23 @@ func (v *View) setRune(x, y int, ch rune) error {
return errors.New("invalid point") return errors.New("invalid point")
} }
var (
ry, rcy int
err error
)
if v.Highlight {
_, ry, err = v.realPosition(x, y)
if err != nil {
return err
}
_, rcy, err = v.realPosition(v.cx, v.cy)
if err != nil {
return err
}
}
var fgColor, bgColor Attribute var fgColor, bgColor Attribute
if v.Highlight && y == v.cy { if v.Highlight && ry == rcy {
fgColor = v.SelFgColor fgColor = v.SelFgColor
bgColor = v.SelBgColor bgColor = v.SelBgColor
} else { } else {