Add scroll left/right support

This commit is contained in:
Maxime Coste 2013-07-24 01:38:30 +02:00
parent 8633a37dad
commit 62fdacb757
4 changed files with 14 additions and 0 deletions

View File

@ -161,6 +161,8 @@ view.
* _vb_: scroll to put the main selection on the bottom line of the window * _vb_: scroll to put the main selection on the bottom line of the window
* _vj_: scroll the window count line downward * _vj_: scroll the window count line downward
* _vk_: scroll the window count line upward * _vk_: scroll the window count line upward
* _vh_: scroll the window count columns left
* _vl_: scroll the window count columns right
Multi Selection Multi Selection
--------------- ---------------

View File

@ -194,6 +194,12 @@ void view_commands(Context& context)
case 'k': case 'k':
context.window().scroll(-std::max<LineCount>(1, context.numeric_param())); context.window().scroll(-std::max<LineCount>(1, context.numeric_param()));
break; break;
case 'l':
context.window().scroll( std::max<CharCount>(1, context.numeric_param()));
break;
case 'h':
context.window().scroll(-std::max<CharCount>(1, context.numeric_param()));
break;
} }
}); });
} }

View File

@ -57,6 +57,11 @@ void Window::scroll(LineCount offset)
m_position.line = std::max(0_line, m_position.line + offset); m_position.line = std::max(0_line, m_position.line + offset);
} }
void Window::scroll(CharCount offset)
{
m_position.column = std::max(0_char, m_position.column + offset);
}
void Window::update_display_buffer() void Window::update_display_buffer()
{ {
scroll_to_keep_cursor_visible_ifn(); scroll_to_keep_cursor_visible_ifn();

View File

@ -35,6 +35,7 @@ public:
void center_selection(); void center_selection();
void display_selection_at(LineCount line); void display_selection_at(LineCount line);
void scroll(LineCount offset); void scroll(LineCount offset);
void scroll(CharCount offset);
void update_display_buffer(); void update_display_buffer();
DisplayCoord display_position(const BufferCoord& coord); DisplayCoord display_position(const BufferCoord& coord);