Add zj and zk command for scrolling the window
This commit is contained in:
parent
e4d87ee1f1
commit
46deca4f3f
|
@ -148,6 +148,8 @@ window.
|
|||
* _zz_ or _zc_: center the main selection in the window
|
||||
* _zt_: scroll to put the main selection on the top line of the window
|
||||
* _zb_: scroll to put the main selection on the bottom line of the window
|
||||
* _zj_: scroll the window count line downward
|
||||
* _zk_: scroll the window count line upward
|
||||
|
||||
Multi Selection
|
||||
---------------
|
||||
|
|
|
@ -167,6 +167,12 @@ void do_disp_cmd(Context& context)
|
|||
case 'b':
|
||||
context.window().display_selection_at(window.dimensions().line-1);
|
||||
break;
|
||||
case 'j':
|
||||
context.window().scroll( std::max<LineCount>(1, context.numeric_param()));
|
||||
break;
|
||||
case 'k':
|
||||
context.window().scroll(-std::max<LineCount>(1, context.numeric_param()));
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -52,6 +52,11 @@ void Window::center_selection()
|
|||
display_selection_at(m_dimensions.line/2_line);
|
||||
}
|
||||
|
||||
void Window::scroll(LineCount offset)
|
||||
{
|
||||
m_position.line = std::max(0_line, m_position.line + offset);
|
||||
}
|
||||
|
||||
void Window::update_display_buffer()
|
||||
{
|
||||
scroll_to_keep_cursor_visible_ifn();
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
|
||||
void center_selection();
|
||||
void display_selection_at(LineCount line);
|
||||
void scroll(LineCount offset);
|
||||
void update_display_buffer();
|
||||
|
||||
DisplayCoord display_position(const BufferIterator& it);
|
||||
|
|
Loading…
Reference in New Issue
Block a user