add BufferPane::scroll_window_up() and scroll_window_down()
This commit is contained in:
parent
92d9597f2e
commit
94eb9276d9
@ -608,6 +608,30 @@ void BufferPane::enter_insert_mode(Window::EnterInsertModeMode which)
|
||||
m_window->request_redraw();
|
||||
}
|
||||
|
||||
void BufferPane::scroll_window_up()
|
||||
{
|
||||
const int lines_to_scroll = 3;
|
||||
int so = effective_scroll_offset();
|
||||
int lines_to_move_cursor = (so + lines_to_scroll) - (m_rows - m_cursor_screen_row - 1);
|
||||
while (lines_to_move_cursor-- > 0)
|
||||
{
|
||||
move_cursor_screen_row_up();
|
||||
}
|
||||
m_cursor_screen_row += lines_to_scroll;
|
||||
}
|
||||
|
||||
void BufferPane::scroll_window_down()
|
||||
{
|
||||
const int lines_to_scroll = 3;
|
||||
int so = effective_scroll_offset();
|
||||
int lines_to_move_cursor = (so + lines_to_scroll) - m_cursor_screen_row;
|
||||
while (lines_to_move_cursor-- > 0)
|
||||
{
|
||||
move_cursor_screen_row_down();
|
||||
}
|
||||
m_cursor_screen_row -= lines_to_scroll;
|
||||
}
|
||||
|
||||
void BufferPane::forward_to_column(int column, bool allow_eol)
|
||||
{
|
||||
Buffer::Iterator start_of_line = *m_iterator;
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
void kill_character_at_cursor();
|
||||
void write_file();
|
||||
bool insert_mode() const { return m_buffer->insert_mode(); }
|
||||
void scroll_window_up();
|
||||
void scroll_window_down();
|
||||
|
||||
protected:
|
||||
int effective_scroll_offset()
|
||||
|
Loading…
x
Reference in New Issue
Block a user