summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-05-11 13:39:42 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-05-11 13:39:52 +0200
commitb33b4e8019c04ea68614968fded87b47e1aada45 (patch)
tree0dabd6d48fe920e3c234029e88d8df0037bf7671
parentgo fmt (diff)
Properly show cursor on two-width characters
-rw-r--r--ui/editor.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/ui/editor.go b/ui/editor.go
index 6cbc6d6..12b0f24 100644
--- a/ui/editor.go
+++ b/ui/editor.go
@@ -324,12 +324,6 @@ func (e *Editor) Draw(screen tcell.Screen, x0, y int) {
x++
}
- curStart := e.textWidth[e.cursorIdx] - e.textWidth[e.offsetIdx]
- curEnd := curStart + 1
- if e.cursorIdx+1 < len(e.textWidth) {
- curEnd = e.textWidth[e.cursorIdx+1] - e.textWidth[e.offsetIdx]
- }
- for x := x0 + curStart; x < x0+curEnd; x++ {
- screen.ShowCursor(x, y)
- }
+ cursorX := x0 + e.textWidth[e.cursorIdx] - e.textWidth[e.offsetIdx]
+ screen.ShowCursor(cursorX, y)
}