autocompletion kinda maybe

This commit is contained in:
Simon Gardling
2022-03-28 20:57:51 -04:00
parent 6d57d96bb2
commit f4aeb80cf8
2 changed files with 87 additions and 3 deletions

View File

@@ -493,9 +493,15 @@ impl MathApp {
// Contains the function string in a text box that the user can edit
let hint = generate_hint(&self.func_strs[i]);
TextEdit::singleline(&mut self.func_strs[i])
.hint_text(hint, true)
.ui(ui);
let func_edit_focus = TextEdit::singleline(&mut self.func_strs[i])
.hint_text(hint.clone(), true)
.ui(ui)
.has_focus();
// If in focus and right arrow key was pressed, apply hint
if func_edit_focus && ui.input().key_down(Key::ArrowRight) {
self.func_strs[i] += &hint;
}
});
let proc_func_str = process_func_str(&self.func_strs[i]);