From 0c5a61611351fd2893a8a8540c587b6e1f2138d4 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 6 Feb 2024 23:49:59 +0100 Subject: [PATCH] Show autosuggestion again after undoing deletion Commit e5b34d5cd (Suppress autosuggesting during backspacing like browsers do, 2012-02-06) disabled autosuggestion when backspacing. Autosuggestions are re-enabled whenever we insert anything in the command line. Undo uses a different code path to insert into the command line, which does not re-enable autosuggestion. Fix that. Also re-enable autosuggestion when undo erases from the command line. This seems like the simplest approach. It's not clear if there's a better behavior; browsers don't agree on one in any case. --- src/reader.rs | 1 + tests/checks/tmux-complete.fish | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/reader.rs b/src/reader.rs index 3cf55eb42..eb76111df 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2932,6 +2932,7 @@ impl ReaderData { self.flash(); return; } + self.suppress_autosuggestion = false; if elt == EditableLineTag::Commandline { self.clear_pager(); } diff --git a/tests/checks/tmux-complete.fish b/tests/checks/tmux-complete.fish index 45088def6..f4c060a87 100644 --- a/tests/checks/tmux-complete.fish +++ b/tests/checks/tmux-complete.fish @@ -77,3 +77,10 @@ isolated-tmux send-keys C-u echo Space old-arg Enter C-l foo2 Space Tab Tab M-. tmux-sleep isolated-tmux capture-pane -p # CHECK: prompt 5> foo2 aabc old-arg + +isolated-tmux send-keys C-u 'echo suggest this' Enter C-l +tmux-sleep +isolated-tmux send-keys 'echo sug' C-w C-z +tmux-sleep +isolated-tmux capture-pane -p +# CHECK: prompt 6> echo suggest this