commit b33b4e8

Hubert Hirtz  ·  2021-05-11 11:39:42 +0000 UTC
parent d4de0b8
Properly show cursor on two-width characters
1 files changed,  +2, -8
+2, -8
 1@@ -324,12 +324,6 @@ func (e *Editor) Draw(screen tcell.Screen, x0, y int) {
 2 		x++
 3 	}
 4 
 5-	curStart := e.textWidth[e.cursorIdx] - e.textWidth[e.offsetIdx]
 6-	curEnd := curStart + 1
 7-	if e.cursorIdx+1 < len(e.textWidth) {
 8-		curEnd = e.textWidth[e.cursorIdx+1] - e.textWidth[e.offsetIdx]
 9-	}
10-	for x := x0 + curStart; x < x0+curEnd; x++ {
11-		screen.ShowCursor(x, y)
12-	}
13+	cursorX := x0 + e.textWidth[e.cursorIdx] - e.textWidth[e.offsetIdx]
14+	screen.ShowCursor(cursorX, y)
15 }