feat(explorer): bind "="/"_" to "Zoom in"/"Zoom out"

pull/9/head
wongjiahau 2 years ago
parent 899491ba25
commit 6af9a06e74

@ -29,6 +29,7 @@ TODO
- [x] refactor, add tree.expand_children() method - [x] refactor, add tree.expand_children() method
New: New:
- [x] increase indentation
- [x] Change '[' to "go to previous root" - [x] Change '[' to "go to previous root"
- [x] Change 'b' to "go to parent" - [x] Change 'b' to "go to parent"
- [x] Use C-o for jumping to previous position - [x] Use C-o for jumping to previous position
@ -44,6 +45,7 @@ New:
- [x] add integration test for Explorer - [x] add integration test for Explorer
- [x] bind "o" to open/close file/folder - [x] bind "o" to open/close file/folder
- [x] bind "C-n/C-p" to up/down - [x] bind "C-n/C-p" to up/down
- [x] bind "="/"_" to zoom-in/zoom-out
- [] search highlight matching word - [] search highlight matching word
- [] Error didn't clear - [] Error didn't clear
- [] should preview be there by default? - [] should preview be there by default?

@ -797,8 +797,8 @@ impl Component for Explorer {
key!('[') => self.go_to_previous_root(), key!('[') => self.go_to_previous_root(),
key!('d') => self.new_remove_prompt()?, key!('d') => self.new_remove_prompt()?,
key!('r') => self.new_rename_prompt(cx), key!('r') => self.new_rename_prompt(cx),
key!('-') => self.decrease_size(), key!('-') | key!('_') => self.decrease_size(),
key!('+') => self.increase_size(), key!('+') | key!('=') => self.increase_size(),
_ => { _ => {
self.tree self.tree
.handle_event(&Event::Key(*key_event), cx, &mut self.state, &filter); .handle_event(&Event::Key(*key_event), cx, &mut self.state, &filter);

@ -662,7 +662,10 @@ impl<T: TreeViewItem> TreeView<T> {
fn move_right(&mut self, cols: usize) { fn move_right(&mut self, cols: usize) {
self.pre_render = Some(Box::new(move |tree, area| { self.pre_render = Some(Box::new(move |tree, area| {
let max_scroll = tree.max_len.saturating_sub(area.width as usize); let max_scroll = tree
.max_len
.saturating_sub(area.width as usize)
.saturating_add(1);
tree.column = max_scroll.min(tree.column + cols); tree.column = max_scroll.min(tree.column + cols);
})); }));
} }

Loading…
Cancel
Save