mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 14:34:05 +00:00
reader: Only abort history search on cancel
Otherwise we'd undo the history search when you press e.g. execute, which means you'd execute the search term. Only `cancel` should walk it back, like it previously did hardcoded to escape. Fixes #5891.
This commit is contained in:
parent
a5a5ccb73d
commit
6c0ae7477e
1 changed files with 3 additions and 2 deletions
|
@ -3267,11 +3267,12 @@ maybe_t<wcstring> reader_data_t::readline(int nchars_or_0) {
|
||||||
handle_readline_command(readline_cmd, rls);
|
handle_readline_command(readline_cmd, rls);
|
||||||
|
|
||||||
if (command_ends_history_search(readline_cmd)) {
|
if (command_ends_history_search(readline_cmd)) {
|
||||||
if (history_search.active()) {
|
// "cancel" means to abort the whole thing, other ending commands mean to finish the search.
|
||||||
|
if (history_search.active() && readline_cmd == rl::cancel) {
|
||||||
history_search.go_to_end();
|
history_search.go_to_end();
|
||||||
update_command_line_from_history_search();
|
update_command_line_from_history_search();
|
||||||
history_search.reset();
|
|
||||||
}
|
}
|
||||||
|
history_search.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
rls.last_cmd = readline_cmd;
|
rls.last_cmd = readline_cmd;
|
||||||
|
|
Loading…
Reference in a new issue