Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2b4c9c

Browse files
author
Sebastian Thiel
committed
page up and down in navigation
1 parent 2aad00a commit a2b4c9c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/interactive/app.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ pub struct TerminalApp {
2828
}
2929

3030
enum CursorDirection {
31+
PageDown,
3132
Down,
3233
Up,
34+
PageUp,
3335
}
3436

3537
impl TerminalApp {
@@ -72,8 +74,10 @@ impl TerminalApp {
7274
Char('O') => self.open_that(),
7375
Char('u') => self.exit_node(),
7476
Char('o') => self.enter_node(),
77+
Ctrl('u') => self.change_vertical_index(CursorDirection::PageUp),
7578
Char('k') => self.change_vertical_index(CursorDirection::Up),
7679
Char('j') => self.change_vertical_index(CursorDirection::Down),
80+
Ctrl('d') => self.change_vertical_index(CursorDirection::PageDown),
7781
Char('s') => self.state.sorting.toggle_size(),
7882
Ctrl('c') | Char('q') => break,
7983
_ => {}
@@ -126,8 +130,10 @@ impl TerminalApp {
126130
.iter()
127131
.find_position(|(idx, _)| *idx == *selected)
128132
.map(|(idx, _)| match direction {
133+
CursorDirection::PageDown => idx.saturating_add(10),
129134
CursorDirection::Down => idx.saturating_add(1),
130135
CursorDirection::Up => idx.saturating_sub(1),
136+
CursorDirection::PageUp => idx.saturating_sub(10),
131137
})
132138
.unwrap_or(0),
133139
None => 0,

0 commit comments

Comments
 (0)