From a719f9d537f47e1388b9d6f039b8b3b4eee712f3 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 25 Dec 2024 05:13:38 +0100 Subject: [PATCH] Minor refactoring in handle_execute A failing ctrl-r search term is inserted back into the command line. This should go through the same code path as other editions. --- src/reader.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/reader.rs b/src/reader.rs index f397982b9..7dd872234 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -3589,13 +3589,9 @@ impl<'a> Reader<'a> { // If the user hits return while navigating the pager, it only clears the pager. if self.is_navigating_pager_contents() { if self.history_pager.is_some() && self.pager.selected_completion_idx.is_none() { - self.data.command_line.push_edit( - Edit::new( - 0..self.data.command_line.len(), - self.data.pager.search_field_line.text().to_owned(), - ), - /*allow_coalesce=*/ false, - ); + let range = 0..self.data.command_line.len(); + let failed_search_string = self.data.pager.search_field_line.text().to_owned(); + self.replace_substring(EditableLineTag::Commandline, range, failed_search_string); self.data .command_line .set_position(self.data.pager.search_field_line.position());