feat(tree): add C-n/C-p keybinding

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

@ -43,6 +43,7 @@ New:
- [x] explorer(preview): content not sorted
- [x] add integration test for Explorer
- [x] bind "o" to open/close file/folder
- [x] bind "C-n/C-p" to up/down
- [] search highlight matching word
- [] Error didn't clear
- [] should preview be there by default?

@ -510,8 +510,8 @@ impl<T: TreeViewItem> TreeView<T> {
pub fn tree_view_help() -> Vec<(&'static str, &'static str)> {
vec![
("o, Enter", "Open/Close"),
("j, down", "Down"),
("k, up", "Up"),
("j, down, C-n", "Down"),
("k, up, C-p", "Up"),
("h, left", "Go to parent"),
("l, right", "Expand"),
("f", "Filter"),
@ -972,8 +972,8 @@ impl<T: TreeViewItem + Clone> TreeView<T> {
let count = std::mem::replace(&mut self.count, 0);
match key_event {
key!(i @ '0'..='9') => self.count = i.to_digit(10).unwrap() as usize + count * 10,
key!('k') | key!(Up) => self.move_up(1.max(count)),
key!('j') | key!(Down) => self.move_down(1.max(count)),
key!('k') | key!(Up) | ctrl!('p') => self.move_up(1.max(count)),
key!('j') | key!(Down) | ctrl!('n') => self.move_down(1.max(count)),
key!('z') => {
self.on_next_key = Some(Box::new(|_, tree, event| match event {
key!('z') => tree.align_view_center(),

Loading…
Cancel
Save