Don't draw cursorline at cursor position
Fixes #622 If the cursorline is drawn at the cursor's position, then the cursor doesn't display. I'm not really sure why this is a problem with the gnome terminal, it didn't seem to happen on earlier versions.
This commit is contained in:
parent
843867717c
commit
6458d3cac4
1 changed files with 6 additions and 1 deletions
|
@ -850,11 +850,13 @@ func (v *View) DisplayView() {
|
|||
lastX := 0
|
||||
var realLoc Loc
|
||||
var visualLoc Loc
|
||||
var cx, cy int
|
||||
if lastChar != nil {
|
||||
lastX = xOffset + lastChar.visualLoc.X + lastChar.width
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == lastChar.realLoc.Y && v.Cursor.X == lastChar.realLoc.X+1 {
|
||||
screen.ShowCursor(lastX, yOffset+lastChar.visualLoc.Y)
|
||||
cx, cy = lastX, yOffset+lastChar.visualLoc.Y
|
||||
}
|
||||
realLoc = Loc{lastChar.realLoc.X, realLineN}
|
||||
visualLoc = Loc{lastX - xOffset, lastChar.visualLoc.Y}
|
||||
|
@ -862,6 +864,7 @@ func (v *View) DisplayView() {
|
|||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == realLineN {
|
||||
screen.ShowCursor(xOffset, yOffset+visualLineN)
|
||||
cx, cy = xOffset, yOffset+visualLineN
|
||||
}
|
||||
lastX = xOffset
|
||||
realLoc = Loc{0, realLineN}
|
||||
|
@ -886,7 +889,9 @@ func (v *View) DisplayView() {
|
|||
style := GetColor("cursor-line")
|
||||
fg, _, _ := style.Decompose()
|
||||
style = style.Background(fg)
|
||||
screen.SetContent(i, yOffset+visualLineN, ' ', nil, style)
|
||||
if !(tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && i == cx && yOffset+visualLineN == cy) {
|
||||
screen.SetContent(i, yOffset+visualLineN, ' ', nil, style)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue