aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Maheshwari <utkarshme96@gmail.com>2018-09-05 00:04:40 +0530
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:22 +0100
commit882dd63dc735a7826f6ee0888a404f13f6c7cb80 (patch)
tree22781d5a32e83b7884faacb480a66ca2ee3a1f82
parent1a896bc93f9c54cc8b973feba1963fd6b60a22b7 (diff)
downloadrneovim-882dd63dc735a7826f6ee0888a404f13f6c7cb80.tar.gz
rneovim-882dd63dc735a7826f6ee0888a404f13f6c7cb80.tar.bz2
rneovim-882dd63dc735a7826f6ee0888a404f13f6c7cb80.zip
multigrid: Fix grid allocation misses
- Clear whole grid in one go. - Fix wrongly sent "copy" flag. - Add clear function comment.
-rw-r--r--src/nvim/screen.c17
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);