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.
This commit is contained in:
Johannes Altmanninger 2024-02-06 23:49:59 +01:00
parent dc75367343
commit 0c5a616113
2 changed files with 8 additions and 0 deletions

View file

@ -2932,6 +2932,7 @@ impl ReaderData {
self.flash();
return;
}
self.suppress_autosuggestion = false;
if elt == EditableLineTag::Commandline {
self.clear_pager();
}

View file

@ -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