fix consumed keys
This commit is contained in:
parent
d143bffa16
commit
37c936f21f
@ -151,10 +151,10 @@ impl FunctionEntry {
|
|||||||
/// Returns whether or not the function text box is in focus
|
/// Returns whether or not the function text box is in focus
|
||||||
pub fn auto_complete(&mut self, ui: &mut egui::Ui, string: &mut String) -> bool {
|
pub fn auto_complete(&mut self, ui: &mut egui::Ui, string: &mut String) -> bool {
|
||||||
// Put here so these key presses don't interact with other elements
|
// Put here so these key presses don't interact with other elements
|
||||||
let consumables_pressed = ui
|
let enter_pressed = ui
|
||||||
.input_mut()
|
.input_mut()
|
||||||
.consume_key(egui::Modifiers::NONE, Key::Enter)
|
.consume_key(egui::Modifiers::NONE, Key::Enter);
|
||||||
| ui.input_mut().consume_key(egui::Modifiers::NONE, Key::Tab);
|
let tab_pressed = ui.input_mut().consume_key(egui::Modifiers::NONE, Key::Tab);
|
||||||
|
|
||||||
let te_id = ui.make_persistent_id("text_edit_ac".to_string());
|
let te_id = ui.make_persistent_id("text_edit_ac".to_string());
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ impl FunctionEntry {
|
|||||||
// If in focus and right arrow key was pressed, apply hint
|
// If in focus and right arrow key was pressed, apply hint
|
||||||
if func_edit_focus {
|
if func_edit_focus {
|
||||||
let mut push_cursor: bool = false;
|
let mut push_cursor: bool = false;
|
||||||
let apply_key = ui.input().key_pressed(Key::ArrowRight) | consumables_pressed;
|
let apply_key = ui.input().key_pressed(Key::ArrowRight) | enter_pressed | tab_pressed;
|
||||||
|
|
||||||
if apply_key && let Some(single_hint) = self.autocomplete.hint.get_single() {
|
if apply_key && let Some(single_hint) = self.autocomplete.hint.get_single() {
|
||||||
push_cursor = true;
|
push_cursor = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user