fix autocomplete pop ups
This commit is contained in:
parent
777a523aad
commit
683a471dbb
@ -91,9 +91,9 @@ impl FunctionEntry {
|
|||||||
pub fn get_func_raw(&self) -> String { self.raw_func_str.to_string() }
|
pub fn get_func_raw(&self) -> String { self.raw_func_str.to_string() }
|
||||||
|
|
||||||
pub fn auto_complete(
|
pub fn auto_complete(
|
||||||
&mut self, ui: &mut egui::Ui, string: &mut String,
|
&mut self, ui: &mut egui::Ui, string: &mut String, i: i32,
|
||||||
) -> (bool, bool, Option<String>) {
|
) -> (bool, bool, Option<String>) {
|
||||||
let (output_string, in_focus) = self.autocomplete.ui(ui, string.to_string());
|
let (output_string, in_focus) = self.autocomplete.ui(ui, string.to_string(), i);
|
||||||
|
|
||||||
let changed = output_string != *string;
|
let changed = output_string != *string;
|
||||||
if changed {
|
if changed {
|
||||||
|
|||||||
@ -485,7 +485,7 @@ impl MathApp {
|
|||||||
|
|
||||||
// Contains the function string in a text box that the user can edit
|
// Contains the function string in a text box that the user can edit
|
||||||
let (focused, changed, error) =
|
let (focused, changed, error) =
|
||||||
function.auto_complete(ui, &mut self.func_strs[i]);
|
function.auto_complete(ui, &mut self.func_strs[i], i as i32);
|
||||||
if focused {
|
if focused {
|
||||||
self.text_boxes_focused = true;
|
self.text_boxes_focused = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,13 +33,13 @@ impl AutoComplete {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ui(&mut self, ui: &mut egui::Ui, string: String) -> (String, bool) {
|
pub fn ui(&mut self, ui: &mut egui::Ui, string: String, func_i: i32) -> (String, bool) {
|
||||||
let mut new_string = string.clone();
|
let mut new_string = string.clone();
|
||||||
// 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 enter_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Enter);
|
let enter_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Enter);
|
||||||
let tab_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Tab);
|
let tab_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Tab);
|
||||||
|
|
||||||
let te_id = ui.make_persistent_id("text_edit_ac".to_string());
|
let te_id = ui.make_persistent_id(format!("text_edit_ac_{}", func_i));
|
||||||
|
|
||||||
// update self
|
// update self
|
||||||
self.changed(string.clone());
|
self.changed(string.clone());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user