diff --git a/src/reader.cpp b/src/reader.cpp index 239320c29..a236ef480 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1578,7 +1578,6 @@ void reader_data_t::delete_char(bool backward) { void reader_data_t::insert_string(editable_line_t *el, const wcstring &str) { if (str.empty()) return; - command_line_has_transient_edit = false; if (!history_search.active() && want_to_coalesce_insertion_of(*el, str)) { el->insert_coalesce(str); assert(el->undo_history.may_coalesce); @@ -1587,7 +1586,10 @@ void reader_data_t::insert_string(editable_line_t *el, const wcstring &str) { el->undo_history.may_coalesce = el->undo_history.try_coalesce || (str.size() == 1); } - if (el == &command_line) suppress_autosuggestion = false; + if (el == &command_line) { + command_line_has_transient_edit = false; + suppress_autosuggestion = false; + } // The pager needs to be refiltered. if (el == &this->pager.search_field_line) { command_line_changed(el); diff --git a/tests/checks/tmux-complete.fish b/tests/checks/tmux-complete.fish index 3c12a02ac..f29a1e98c 100644 --- a/tests/checks/tmux-complete.fish +++ b/tests/checks/tmux-complete.fish @@ -39,3 +39,12 @@ isolated-tmux capture-pane -p | sed -n '1p;$p' # CHECK: prompt 3> begin # Also ensure that the pager is actually fully disclosed. # CHECK: rows 1 to {{\d+}} of {{\d+}} + +# Canceling the pager removes the inserted completion, no mater what happens in the search field. +# The common prefix remains because it is inserted before the pager is shown. +isolated-tmux send-keys C-c +tmux-sleep +isolated-tmux send-keys C-l foo2 Space BTab b BSpace b Escape +tmux-sleep +isolated-tmux capture-pane -p +# CHECK: prompt 3> foo2 aa