Skip to content

Commit

Permalink
non-stupid escape handling (not great either but oh well)
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Jan 11, 2025
1 parent 02988a2 commit e0fa976
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/viewer/re_ui/src/filter_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ impl FilterState {
.show_flat(
ui,
list_item::CustomContent::new(|ui, _| {
if self.inner_state.is_some()
&& ui.input_mut(|i| {
i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)
})
{
self.inner_state = None;
}

if let Some(inner_state) = self.inner_state.as_mut() {
// we add additional spacing for aesthetic reasons (active text edits have a
// fat border)
Expand All @@ -113,8 +121,6 @@ impl FilterState {
if self.request_focus {
self.request_focus = false;
response.request_focus();
} else if response.lost_focus() {
self.inner_state = None;
}
} else {
ui.label(galley);
Expand Down

0 comments on commit e0fa976

Please sign in to comment.