Skip to content

Commit

Permalink
fix: preserve focus on filter clear after first startup
Browse files Browse the repository at this point in the history
  • Loading branch information
cablehead committed Jun 14, 2024
1 parent f25755a commit ecacca1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src-tauri/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ impl UI {
Some(matches)
} else {
// preserve current focus when clearing the filter
self.select(self.view.get_best_focus(&self.focused));

// if the current focus is a stack, navigate right, and then left to cause
// last_selected to be set in order to preserve the current focus
// last_selected to be set in order to preserve the current sub-focus
if let Some(focused) = self.focused.as_ref() {
if focused.item.stack_id.is_none() {
self.select_right();
self.select_left();
}
} else {
// otherwise just lock in the current focus
self.select(self.view.get_best_focus(&self.focused));
}

None
Expand Down

0 comments on commit ecacca1

Please sign in to comment.