mirror of
https://github.com/nushell/nushell.git
synced 2024-12-27 17:39:15 +01:00
Merge pull request #775 from JonnyWalker81/vi-textview-scroll
Added Vi support for scrolling in the textview command.
This commit is contained in:
commit
124a814f4d
@ -150,7 +150,7 @@ fn scroll_view_lines_if_needed(draw_commands: Vec<DrawCommand>, use_color_buffer
|
||||
KeyEvent::Esc => {
|
||||
break;
|
||||
}
|
||||
KeyEvent::Up => {
|
||||
KeyEvent::Up | KeyEvent::Char('k') => {
|
||||
if starting_row > 0 {
|
||||
starting_row -= 1;
|
||||
max_bottom_line = paint_textview(
|
||||
@ -160,19 +160,19 @@ fn scroll_view_lines_if_needed(draw_commands: Vec<DrawCommand>, use_color_buffer
|
||||
);
|
||||
}
|
||||
}
|
||||
KeyEvent::Down => {
|
||||
KeyEvent::Down | KeyEvent::Char('j') => {
|
||||
if starting_row < (max_bottom_line - height) {
|
||||
starting_row += 1;
|
||||
}
|
||||
max_bottom_line =
|
||||
paint_textview(&draw_commands, starting_row, use_color_buffer);
|
||||
}
|
||||
KeyEvent::PageUp => {
|
||||
KeyEvent::PageUp | KeyEvent::Ctrl('b') => {
|
||||
starting_row -= std::cmp::min(height, starting_row);
|
||||
max_bottom_line =
|
||||
paint_textview(&draw_commands, starting_row, use_color_buffer);
|
||||
}
|
||||
KeyEvent::PageDown | KeyEvent::Char(' ') => {
|
||||
KeyEvent::PageDown | KeyEvent::Ctrl('f') | KeyEvent::Char(' ') => {
|
||||
if starting_row < (max_bottom_line - height) {
|
||||
starting_row += height;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user