diff --git a/doc_src/cmds/commandline.rst b/doc_src/cmds/commandline.rst index 73659a587..808a0093c 100644 --- a/doc_src/cmds/commandline.rst +++ b/doc_src/cmds/commandline.rst @@ -71,7 +71,7 @@ The following options change what part of the commandline is printed or updated: Selects the current token **--search-field** - Use the pager search field instead of the command line. Returns false is the search field is not shown. + Use the pager search field instead of the command line. Returns false if the search field is not shown. The following options change the way ``commandline`` prints the current commandline buffer: diff --git a/src/reader.rs b/src/reader.rs index b2f5fb78a..ea8e4356c 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1256,13 +1256,14 @@ fn update_commandline_state(&self) { snapshot.selection = self.get_selection(); snapshot.pager_mode = !self.pager.is_empty(); snapshot.pager_fully_disclosed = self.current_page_rendering.remaining_to_disclose == 0; - if snapshot - .search_field - .as_ref() - .is_none_or(|(text, position)| { - text != self.pager.search_field_line.text() - || *position != self.pager.search_field_line.position() - }) + if (snapshot.search_field.is_some() != self.pager.search_field_shown) + || snapshot + .search_field + .as_ref() + .is_some_and(|(text, position)| { + text != self.pager.search_field_line.text() + || *position != self.pager.search_field_line.position() + }) { snapshot.search_field = self.pager.search_field_shown.then(|| { (