From e5b8035fea4e366f82ee127e8f04b0a8a004dca7 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 30 Jun 2020 22:20:14 +0200 Subject: [PATCH] Fix updating command line on Page-Down Page-Down seems to deactivate history search, so trying to undo would leave the command line in an inconsistent state. Fixes #7162 which was introduced in 12a9cb29 Fix assertion failure on page up / page down --- src/reader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 8a9a8de54..b0fedc654 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2059,10 +2059,9 @@ void reader_data_t::update_command_line_from_history_search() { } if (history_search.by_token()) { replace_current_token(std::move(new_text)); - } else if (history_search.by_line() || history_search.by_prefix()) { - el->replace_substring(0, el->size(), std::move(new_text)); } else { - return; + assert(history_search.by_line() || history_search.by_prefix()); + el->replace_substring(0, el->size(), std::move(new_text)); } command_line_has_transient_edit = true; assert(el == &command_line); @@ -3124,7 +3123,9 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat } else { history_search.go_to_end(); } - update_command_line_from_history_search(); + if (history_search.active()) { + update_command_line_from_history_search(); + } } break; }