BufferView: fix more scrolling problems

This commit is contained in:
josh committed 2017-09-23 16:02:34 -04:00
1 parent 33377f7668
commit 1d12a7fe7d
2 files changed
+49 -2

No files matched your search

+6 -2
View File
@@ -195,6 +195,7 @@ bool BufferView::cursor_move(CursorMovement which, bool allow_eol)
void BufferView::scroll_view_up(int n_lines, bool allow_eol)
{
int orig_cursor_screen_row = m_cursor_screen_row;
int so = effective_scroll_offset();
int rows_to_move_cursor = (so + n_lines) - (m_height - m_cursor_screen_row - 1);
rows_to_move_cursor = std::min(calculate_rows_above_screen(rows_to_move_cursor), rows_to_move_cursor);
@@ -204,17 +205,19 @@ void BufferView::scroll_view_up(int n_lines, bool allow_eol)
if (move_cursor_screen_row_up(allow_eol))
{
actual_lines_moved++;
update();
}
else
{
break;
}
}
m_cursor_screen_row += (n_lines - actual_lines_moved);
m_cursor_screen_row = orig_cursor_screen_row + (n_lines - actual_lines_moved);
}
void BufferView::scroll_view_down(int n_lines, bool allow_eol)
{
int orig_cursor_screen_row = m_cursor_screen_row;
int so = effective_scroll_offset();
int rows_to_move_cursor = (so + n_lines) - m_cursor_screen_row;
rows_to_move_cursor = std::min(calculate_rows_below_screen(rows_to_move_cursor), rows_to_move_cursor);
@@ -224,13 +227,14 @@ void BufferView::scroll_view_down(int n_lines, bool allow_eol)
if (move_cursor_screen_row_down(allow_eol))
{
actual_lines_moved++;
update();
}
else
{
break;
}
}
m_cursor_screen_row -= (n_lines - actual_lines_moved);
m_cursor_screen_row = orig_cursor_screen_row - (n_lines - actual_lines_moved);
}
/**************************************************************************