mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
Fix search field state not resetting after search field is hidden
Commit4f536d6a9b(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 commit72f2433120)
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
@@ -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(|| {
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user