aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/screen.c20
-rw-r--r--src/nvim/types.h2
3 files changed, 16 insertions, 8 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 317ae8f41a..1a3cf6886d 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -157,7 +157,7 @@ typedef off_t off_T;
/// Note: before the screen is initialized and when out of memory these can be
/// NULL.
EXTERN ScreenGrid default_grid INIT(= { 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
- 0, 0 });
+ 0, 0, 0 });
#define DEFAULT_GRID_HANDLE 1 /* handle for the default_grid */
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 23853ba13a..dca11fd49e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1573,6 +1573,8 @@ static void win_update(win_T *wp)
}
}
+ wp->w_grid.was_resized = false;
+
/* restore got_int, unless CTRL-C was hit while redrawing */
if (!got_int)
got_int = save_got_int;
@@ -5832,8 +5834,12 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
}
}
- int dirty_first = INT_MAX;
- int dirty_last = 0;
+ // if grid was resized (in ext_multigrid mode), the UI has no redraw updates
+ // for the newly resized grid. It is better mark everything as dirty and
+ // send all the updates.
+ int dirty_first = grid->was_resized ? start_col : INT_MAX;
+ int dirty_last = grid->was_resized ? grid->Columns : 0;
+
int col = start_col;
schar_from_char(sc, c1);
int lineoff = grid->LineOffset[row];
@@ -5846,7 +5852,9 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
if (dirty_first == INT_MAX) {
dirty_first = col;
}
- dirty_last = col+1;
+ if (!grid->was_resized) {
+ dirty_last = col+1;
+ }
}
if (col == start_col) {
schar_from_char(sc, c2);
@@ -5920,7 +5928,6 @@ void win_grid_alloc(win_T *wp, int doclear)
ScreenGrid *grid = &wp->w_grid;
int rows = grid->internal_rows;
int columns = grid->internal_columns;
- int was_resized = 0;
if (rows == 0) {
rows = wp->w_height;
@@ -5935,7 +5942,7 @@ void win_grid_alloc(win_T *wp, int doclear)
grid_alloc(grid, rows, columns, doclear);
win_free_lsize(wp);
win_alloc_lines(wp);
- was_resized = true;
+ grid->was_resized = true;
}
grid->OffsetRow = wp->w_winrow;
@@ -5947,10 +5954,9 @@ void win_grid_alloc(win_T *wp, int doclear)
// - a grid was just resized
// - screen_resize was called and all grid sizes must be sent
// - the UI wants multigrid event (necessary)
- if ((send_grid_resize || was_resized)
+ if ((send_grid_resize || grid->was_resized)
&& ui_is_external(kUIMultigrid)) {
ui_call_grid_resize(grid->handle, grid->Columns, grid->Rows);
- was_resized = false;
}
}
diff --git a/src/nvim/types.h b/src/nvim/types.h
index aa4332fad1..6d39caab50 100644
--- a/src/nvim/types.h
+++ b/src/nvim/types.h
@@ -43,6 +43,8 @@ typedef struct {
// the size expected to be allocated to the internal grid
int internal_rows;
int internal_columns;
+
+ int was_resized;
} ScreenGrid;
#endif // NVIM_TYPES_H