aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-09-22 14:50:58 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:22 +0100
commitf77f09ea6e0e540a636990df84d09166a757482f (patch)
treeba7b88052a60c17527007909b36b67157401ea7c
parentba6f9f60addb569aa223f6e245df78741eab5adf (diff)
downloadrneovim-f77f09ea6e0e540a636990df84d09166a757482f.tar.gz
rneovim-f77f09ea6e0e540a636990df84d09166a757482f.tar.bz2
rneovim-f77f09ea6e0e540a636990df84d09166a757482f.zip
multigrid: don't clear window grids on resize
Instead define that the shared top-left part of the grid is preserved.
-rw-r--r--src/nvim/move.c2
-rw-r--r--src/nvim/screen.c24
2 files changed, 12 insertions, 14 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 4267b4bb61..ebbcd1b853 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -529,7 +529,7 @@ int cursor_valid(void)
*/
void validate_cursor(void)
{
- win_grid_alloc(curwin, true); // we need to have w_grid.Rows/Columns updated
+ win_grid_alloc(curwin, false); // we need to have w_grid.Rows/Columns updated
check_cursor_moved(curwin);
if ((curwin->w_valid & (VALID_WCOL|VALID_WROW)) != (VALID_WCOL|VALID_WROW))
curs_columns(true);
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 17006c2954..953aea0094 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, true);
+ win_grid_alloc(wp, false);
if (type >= NOT_VALID) {
wp->w_redr_status = true;
@@ -5897,8 +5897,8 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
// 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 dirty_first = INT_MAX;
+ int dirty_last = 0;
int col = start_col;
schar_from_char(sc, c1);
@@ -5912,9 +5912,7 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
if (dirty_first == INT_MAX) {
dirty_first = col;
}
- if (!grid->was_resized) {
- dirty_last = col+1;
- }
+ dirty_last = col+1;
}
if (col == start_col) {
schar_from_char(sc, c2);
@@ -6152,7 +6150,7 @@ retry:
void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy)
{
- int new_row, old_row;
+ int new_row;
ScreenGrid new = *grid;
size_t ncells = (size_t)((rows+1) * columns);
@@ -6168,21 +6166,20 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy)
new.LineOffset[new_row] = new_row * new.Columns;
new.LineWraps[new_row] = false;
- grid_clear_line(&new, 0, columns);
+ grid_clear_line(&new, new.LineOffset[new_row], columns, true);
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).
- old_row = new_row + (grid->Rows - new.Rows);
- if (old_row >= 0 && grid->ScreenLines != NULL) {
+ if (new_row < grid->Rows && grid->ScreenLines != NULL) {
int len = MIN(grid->Columns, new.Columns);
memmove(new.ScreenLines + new.LineOffset[new_row],
- grid->ScreenLines + grid->LineOffset[old_row],
+ grid->ScreenLines + grid->LineOffset[new_row],
(size_t)len * sizeof(schar_T));
memmove(new.ScreenAttrs + new.LineOffset[new_row],
- grid->ScreenAttrs + grid->LineOffset[old_row],
+ grid->ScreenAttrs + grid->LineOffset[new_row],
(size_t)len * sizeof(sattr_T));
}
}
@@ -6281,7 +6278,8 @@ static void screenclear2(void)
/// clear a line in the grid starting at "off" until "width" characters
/// are cleared.
-static void grid_clear_line(ScreenGrid *grid, unsigned off, int width, bool valid)
+static void grid_clear_line(ScreenGrid *grid, unsigned off, int width,
+ bool valid)
{
for (int col = 0; col < width; col++) {
schar_from_ascii(grid->ScreenLines[off + col], ' ');