Make any character insertion end history search

Currently, if you enter `echo` and press up-arrow, it might select
e.g. `echo foo`.

You can then enter text, making it `echo foobar` and press up-arrow
again, but the search string is *still* `echo`.

Many *other* input functions will end history search, including e.g.
expand-abbr, so pressing space by default will already end it.

So this ends the history search once you input something.

Incidentally this allows suggestions to work in this case, so it

Fixes #10287

Note that autosuggestions have been disabled while history search is
active since a08450bcb6, I'm not sure
it's actually *needed*, so it would also be possible to enable it in
that case.

But since this is already awkward (history search is *active* but with
the old search string) and I'm not sure if e.g. suggestions during
history search would be too busy, let's do this first.
This commit is contained in:
Fabian Boehm 2024-02-06 17:30:11 +01:00
parent 698be5b9fe
commit 70a5267682

View file

@ -1859,6 +1859,8 @@ impl ReaderData {
if elt == EditableLineTag::Commandline {
zelf.clear_pager();
// We end history search. We could instead update the search string.
zelf.history_search.reset();
}
} else {
// This can happen if the user presses a control char we don't recognize. No