From d8574f8f85bef716f93db4f03cc0a63167f3a715 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Nov 2022 21:18:40 +0530 Subject: [PATCH] Fix another bug in readline cursor position tracking --- tools/tui/readline/draw.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/tui/readline/draw.go b/tools/tui/readline/draw.go index e4e5edcc7..66c334f5d 100644 --- a/tools/tui/readline/draw.go +++ b/tools/tui/readline/draw.go @@ -107,6 +107,7 @@ func (self *Readline) get_screen_lines() []*ScreenLine { cursor_at_start_of_next_line = false sl.CursorCell = prompt.Length sl.CursorTextPos = 0 + found_cursor = true } ans = append(ans, &sl) if has_cursor && !found_cursor && offset <= cursor.X && cursor.X <= offset+len(l) { @@ -198,6 +199,7 @@ func (self *Readline) redraw() { self.loop.QueueWriteString("\r") self.loop.MoveCursorHorizontally(cursor_x) self.cursor_y = 0 + cursor_y -= move_cursor_up_by if cursor_y > 0 { self.cursor_y = cursor_y - 1 }