From b33b4e8019c04ea68614968fded87b47e1aada45 Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Tue, 11 May 2021 13:39:42 +0200 Subject: Properly show cursor on two-width characters --- ui/editor.go | 10 ++-------- 1 file 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) } -- cgit v1.2.3