Move cursor to prev/next sibling

This commit is contained in:
Joscha 2022-08-09 15:44:35 +02:00
parent d65183e0ae
commit a4b79d4e81
3 changed files with 52 additions and 62 deletions

View file

@ -67,6 +67,7 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
pub fn list_movement_key_bindings(&self, bindings: &mut KeyBindingsList) {
bindings.binding("j/k, ↓/↑", "move cursor up/down");
bindings.binding("J/K, ctrl+↓/↑", "move cursor to prev/next sibling");
bindings.binding("h/l, ←/→", "move cursor chronologically");
bindings.binding("H/L, ctrl+←/→", "move cursor to prev/next unseen message");
bindings.binding("g, home", "move cursor to top");
@ -82,6 +83,8 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
match event {
key!('k') | key!(Up) => self.move_cursor_up().await,
key!('j') | key!(Down) => self.move_cursor_down().await,
key!('K') | key!(Ctrl + Up) => self.move_cursor_up_sibling().await,
key!('J') | key!(Ctrl + Down) => self.move_cursor_down_sibling().await,
key!('h') | key!(Left) => self.move_cursor_older().await,
key!('l') | key!(Right) => self.move_cursor_newer().await,
key!('H') | key!(Ctrl + Left) => self.move_cursor_older_unseen().await,