diff options
-rw-r--r-- | src/nvim/screen.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 063363755a..f58dff675e 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -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); |