mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
multigrid: Fix grid allocation misses
- Clear whole grid in one go. - Fix wrongly sent "copy" flag. - Add clear function comment.
This commit is contained in:
parent
1a896bc93f
commit
882dd63dc7
@ -679,7 +679,7 @@ static void win_update(win_T *wp)
|
||||
|
||||
type = wp->w_redr_type;
|
||||
|
||||
win_grid_alloc(wp, false);
|
||||
win_grid_alloc(wp, true);
|
||||
|
||||
if (type >= NOT_VALID) {
|
||||
wp->w_redr_status = true;
|
||||
@ -5966,9 +5966,11 @@ int screen_valid(int doclear)
|
||||
return default_grid.ScreenLines != NULL;
|
||||
}
|
||||
|
||||
/// (re)allocate a window grid if size changed
|
||||
/// If "doclear" is true, clear the screen if resized.
|
||||
// TODO(utkarshme): Think of a better name, place
|
||||
/// (Re)allocates a window grid if size changed while in ext_multigrid mode.
|
||||
/// Updates size, offsets and handle for the grid regardless.
|
||||
///
|
||||
/// If "doclear" is true, don't try to copy from the old grid rather clear the
|
||||
/// resized grid.
|
||||
void win_grid_alloc(win_T *wp, int doclear)
|
||||
{
|
||||
ScreenGrid *grid = &wp->w_grid;
|
||||
@ -6151,15 +6153,14 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy)
|
||||
for (new_row = 0; new_row < new.Rows; new_row++) {
|
||||
new.LineOffset[new_row] = new_row * new.Columns;
|
||||
new.LineWraps[new_row] = false;
|
||||
|
||||
grid_clear_line(&new, 0, columns);
|
||||
|
||||
if (copy) {
|
||||
// If the screen is not going to be cleared, copy as much as
|
||||
// possible from the old screen to the new one and clear the rest
|
||||
// (used when resizing the window at the "--more--" prompt or when
|
||||
// executing an external command, for the GUI).
|
||||
memset(new.ScreenLines + new_row * new.Columns,
|
||||
' ', (size_t)new.Columns * sizeof(schar_T));
|
||||
memset(new.ScreenAttrs + new_row * new.Columns,
|
||||
0, (size_t)new.Columns * sizeof(sattr_T));
|
||||
old_row = new_row + (grid->Rows - new.Rows);
|
||||
if (old_row >= 0 && grid->ScreenLines != NULL) {
|
||||
int len = MIN(grid->Columns, new.Columns);
|
||||
|
Loading…
Reference in New Issue
Block a user