mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
fix(grid): check allocated grid size when suspicious scrolling
fixes #33749
This commit is contained in:
@ -2527,21 +2527,26 @@ void win_scroll_lines(win_T *wp, int row, int line_count)
|
||||
return;
|
||||
}
|
||||
|
||||
// No lines are being moved, just draw over the entire area
|
||||
if (row + abs(line_count) >= wp->w_view_height) {
|
||||
return;
|
||||
}
|
||||
|
||||
int col = 0;
|
||||
int row_off = 0;
|
||||
ScreenGrid *grid = grid_adjust(&wp->w_grid, &row_off, &col);
|
||||
|
||||
// TODO(bfredl): this is due to the call in curs_columns(). We really don't want to
|
||||
// fiddle with the screen outside of update_screen() like this.
|
||||
int checked_width = MIN(grid->cols - col, wp->w_view_width);
|
||||
int checked_height = MIN(grid->rows - row_off, wp->w_view_height);
|
||||
|
||||
// No lines are being moved, just draw over the entire area
|
||||
if (row + abs(line_count) >= checked_height) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (line_count < 0) {
|
||||
grid_del_lines(grid, row + row_off, -line_count,
|
||||
wp->w_view_height + row_off, col, wp->w_view_width);
|
||||
checked_height + row_off, col, checked_width);
|
||||
} else {
|
||||
grid_ins_lines(grid, row + row_off, line_count,
|
||||
wp->w_view_height + row_off, col, wp->w_view_width);
|
||||
checked_height + row_off, col, checked_width);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user