From b3f096b03bf97d58a590bdd7fa1e0f5e494235e4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 26 Nov 2022 15:30:49 +0530 Subject: [PATCH] kitty shell: Fix pressing enter while cursor is not at end of line causes line to be truncated visually --- tools/cmd/at/shell.go | 2 ++ tools/tui/readline/api.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tools/cmd/at/shell.go b/tools/cmd/at/shell.go index a84dda172..350fdc9c6 100644 --- a/tools/cmd/at/shell.go +++ b/tools/cmd/at/shell.go @@ -61,6 +61,8 @@ func shell_loop(rl *readline.Readline, kill_if_signaled bool) (int, error) { rl.Redraw() return nil } + rl.MoveCursorToEnd() + rl.Redraw() lp.ClearToEndOfScreen() return ErrExec } diff --git a/tools/tui/readline/api.go b/tools/tui/readline/api.go index 90f947929..f408f9bc2 100644 --- a/tools/tui/readline/api.go +++ b/tools/tui/readline/api.go @@ -254,6 +254,10 @@ func (self *Readline) AllText() string { return self.all_text() } +func (self *Readline) MoveCursorToEnd() bool { + return self.move_to_end() +} + func (self *Readline) CursorAtEndOfLine() bool { return self.input_state.cursor.X >= len(self.input_state.lines[self.input_state.cursor.Y]) }