mirror of
https://github.com/hannobraun/Fornjot
synced 2025-08-24 11:06:27 +00:00
Always apply up/down key to lowest-level selection
This commit is contained in:
parent
ea792690f2
commit
a260993342
@ -100,13 +100,13 @@ impl ApplicationHandler for App {
|
||||
|
||||
match logical_key {
|
||||
Key::Named(NamedKey::ArrowDown) => {
|
||||
self.view.select_next();
|
||||
self.view.parent_of_selected_mut().select_next();
|
||||
}
|
||||
Key::Named(NamedKey::ArrowRight) => {
|
||||
self.view.selected_mut().select_last();
|
||||
}
|
||||
Key::Named(NamedKey::ArrowUp) => {
|
||||
self.view.select_previous();
|
||||
self.view.parent_of_selected_mut().select_previous();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -90,6 +90,28 @@ impl OperationView {
|
||||
self.children.get_mut(selected).unwrap().selected_mut()
|
||||
}
|
||||
|
||||
pub fn parent_of_selected_mut(&mut self) -> &mut Self {
|
||||
let Some(selected) = self.selected else {
|
||||
return self;
|
||||
};
|
||||
|
||||
// The same comment in `selected_mut` applies here too. Plus, some ugly
|
||||
// duplication.
|
||||
|
||||
if self.children.get_mut(selected).is_none() {
|
||||
return self;
|
||||
};
|
||||
|
||||
if self.children.get_mut(selected).unwrap().selected.is_none() {
|
||||
self
|
||||
} else {
|
||||
self.children
|
||||
.get_mut(selected)
|
||||
.unwrap()
|
||||
.parent_of_selected_mut()
|
||||
}
|
||||
}
|
||||
|
||||
fn last_index(&self) -> usize {
|
||||
self.children.len().saturating_sub(1)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user