Fix search field state not resetting after search field is hidden

Commit 4f536d6a9b (Update commandline state snapshot lazily,
2024-04-13) add an optimization to update the search field only if
necessary.  The optimization accidentally prevents us from resetting
the search field.

Fixes #11161

(cherry picked from commit 72f2433120)
This commit is contained in:
Johannes Altmanninger
2025-02-19 09:52:36 +01:00
parent df56f7155e
commit ebc460b9f9
2 changed files with 9 additions and 8 deletions

View File

@@ -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(|| {
(