Skip to content

Commit

Permalink
feat: clear filter now always preserve the current focus
Browse files Browse the repository at this point in the history
fixes #78
  • Loading branch information
cablehead committed Jun 13, 2024
1 parent 2ab86c3 commit e1f0b97
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src-tauri/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@ 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
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
};
self.refresh_view(v);
Expand Down

0 comments on commit e1f0b97

Please sign in to comment.