fixes (including for keybindings)
This commit is contained in:
parent
734989f1a4
commit
c653c5a1c0
@ -268,6 +268,8 @@ pub struct AppSettings {
|
|||||||
|
|
||||||
/// Stores current plot pixel width
|
/// Stores current plot pixel width
|
||||||
pub plot_width: usize,
|
pub plot_width: usize,
|
||||||
|
|
||||||
|
pub text_boxes_focused: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for AppSettings {
|
impl Default for AppSettings {
|
||||||
@ -287,6 +289,7 @@ impl Default for AppSettings {
|
|||||||
do_extrema: true,
|
do_extrema: true,
|
||||||
do_roots: true,
|
do_roots: true,
|
||||||
plot_width: 0,
|
plot_width: 0,
|
||||||
|
text_boxes_focused: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,6 +449,7 @@ impl MathApp {
|
|||||||
|
|
||||||
let functions_len = self.functions.len();
|
let functions_len = self.functions.len();
|
||||||
let mut remove_i: Option<usize> = None;
|
let mut remove_i: Option<usize> = None;
|
||||||
|
self.settings.text_boxes_focused = false;
|
||||||
for (i, function) in self.functions.iter_mut().enumerate() {
|
for (i, function) in self.functions.iter_mut().enumerate() {
|
||||||
let mut integral_enabled = function.integral;
|
let mut integral_enabled = function.integral;
|
||||||
let mut derivative_enabled = function.derivative;
|
let mut derivative_enabled = function.derivative;
|
||||||
@ -495,8 +499,11 @@ impl MathApp {
|
|||||||
|
|
||||||
// If in focus and right arrow key was pressed, apply hint
|
// If in focus and right arrow key was pressed, apply hint
|
||||||
// TODO: change position of cursor
|
// TODO: change position of cursor
|
||||||
if func_edit_focus && ui.input().key_down(Key::ArrowRight) {
|
if func_edit_focus {
|
||||||
self.func_strs[i] += &hint;
|
self.settings.text_boxes_focused = true;
|
||||||
|
if ui.input().key_down(Key::ArrowRight) {
|
||||||
|
self.func_strs[i] += &hint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -554,10 +561,11 @@ impl epi::App for MathApp {
|
|||||||
false => Visuals::light(),
|
false => Visuals::light(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle show_side_panel on `H` key press
|
if !self.settings.text_boxes_focused {
|
||||||
self.settings
|
self.settings
|
||||||
.show_side_panel
|
.show_side_panel
|
||||||
.bitxor_assign(ctx.input().key_down(Key::H));
|
.bitxor_assign(ctx.input().key_down(Key::H));
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize fonts
|
// Initialize fonts
|
||||||
ctx.set_fonts(ASSETS.fonts.clone());
|
ctx.set_fonts(ASSETS.fonts.clone());
|
||||||
|
|||||||
@ -408,6 +408,7 @@ mod tests {
|
|||||||
do_extrema: false,
|
do_extrema: false,
|
||||||
do_roots: false,
|
do_roots: false,
|
||||||
plot_width: pixel_width,
|
plot_width: pixel_width,
|
||||||
|
text_boxes_focused: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,6 @@ fn gen_completion_hashmap(input: Vec<String>) -> HashMap<String, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(common_substr_unwrapped) = common_substr {
|
if let Some(common_substr_unwrapped) = common_substr {
|
||||||
println!("{}", common_substr_unwrapped);
|
|
||||||
output.insert(key.clone(), common_substr_unwrapped.replace(&key, ""));
|
output.insert(key.clone(), common_substr_unwrapped.replace(&key, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,10 +211,7 @@ mod tests {
|
|||||||
vec![("sin", None), ("cos", None), ("tan", None)];
|
vec![("sin", None), ("cos", None), ("tan", None)];
|
||||||
|
|
||||||
for (key, value) in manual_values {
|
for (key, value) in manual_values {
|
||||||
values.insert(
|
values.insert(key.to_string(), value.map(|x| x.to_string()));
|
||||||
key.to_string(),
|
|
||||||
value.map(|x| x.to_string()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (key, value) in values {
|
for (key, value) in values {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user