From ba67d20b7c4a44c3d5e89aaa2d7074a6bfc9829f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 13 Oct 2024 07:55:31 +0200 Subject: [PATCH] Refresh TTY timestamps after nextd/prevd This fixes a macOS-specific bug. See 390b40e02 (Fix regression not refreshing TTY timestamps after external command from binding, 2024-05-29) and 8a7c3ceec (Don't abandon line after writing control sequences, 2024-04-06). Fixes #10779 --- src/reader.rs | 2 ++ tests/checks/tmux-multiline-prompt.fish | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/reader.rs b/src/reader.rs index e1d62afc3..594e33d12 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2858,6 +2858,7 @@ impl<'a> Reader<'a> { self.force_exec_prompt_and_repaint = true; self.input_data .queue_char(CharEvent::from_readline(ReadlineCmd::Repaint)); + self.save_screen_state(); return; } @@ -2880,6 +2881,7 @@ impl<'a> Reader<'a> { self.force_exec_prompt_and_repaint = true; self.input_data .queue_char(CharEvent::from_readline(ReadlineCmd::Repaint)); + self.save_screen_state(); return; } diff --git a/tests/checks/tmux-multiline-prompt.fish b/tests/checks/tmux-multiline-prompt.fish index add5e2ffd..cbdfa7445 100644 --- a/tests/checks/tmux-multiline-prompt.fish +++ b/tests/checks/tmux-multiline-prompt.fish @@ -33,3 +33,15 @@ isolated-tmux send-keys -X previous-prompt tmux-sleep isolated-tmux display-message -p '#{copy_cursor_y} #{copy_cursor_line}' # CHECK: {{[46]}} prompt-line-1 + +# Test that the prevd binding does not break the prompt. +isolated-tmux send-keys Escape +tmux-sleep +isolated-tmux send-keys M-left +tmux-sleep +isolated-tmux capture-pane -p | tail -n 5 +# CHECK: prompt-line-2> : 5 +# CHECK: prompt-line-1 +# CHECK: prompt-line-2> +# CHECK: +# CHECK: