From 58ff53fa608bba24f51b0dc1fac0a267a0a017be Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 4 Apr 2022 10:19:32 -0400 Subject: [PATCH] move key detection --- src/widgets.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widgets.rs b/src/widgets.rs index 821a871..5dfedd5 100644 --- a/src/widgets.rs +++ b/src/widgets.rs @@ -35,9 +35,6 @@ impl AutoComplete { pub fn ui(&mut self, ui: &mut egui::Ui, string: String, func_i: i32) -> (String, bool) { let mut new_string = string.clone(); - // Put here so these key presses don't interact with other elements - let enter_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Enter); - let tab_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Tab); // update self self.changed(&string); @@ -54,6 +51,10 @@ impl AutoComplete { return (return_string, re.has_focus()); } + // Put here so these key presses don't interact with other elements + let enter_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Enter); + let tab_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Tab); + if let Some(single_hint) = self.hint.get_single() { let func_edit_2 = func_edit; func_edit = func_edit_2.hint_text(&single_hint);