mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
multigrid: don't clear window grids on resize
Instead define that the shared top-left part of the grid is preserved.
This commit is contained in:
@@ -529,7 +529,7 @@ int cursor_valid(void)
|
|||||||
*/
|
*/
|
||||||
void validate_cursor(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);
|
check_cursor_moved(curwin);
|
||||||
if ((curwin->w_valid & (VALID_WCOL|VALID_WROW)) != (VALID_WCOL|VALID_WROW))
|
if ((curwin->w_valid & (VALID_WCOL|VALID_WROW)) != (VALID_WCOL|VALID_WROW))
|
||||||
curs_columns(true);
|
curs_columns(true);
|
||||||
|
@@ -679,7 +679,7 @@ static void win_update(win_T *wp)
|
|||||||
|
|
||||||
type = wp->w_redr_type;
|
type = wp->w_redr_type;
|
||||||
|
|
||||||
win_grid_alloc(wp, true);
|
win_grid_alloc(wp, false);
|
||||||
|
|
||||||
if (type >= NOT_VALID) {
|
if (type >= NOT_VALID) {
|
||||||
wp->w_redr_status = true;
|
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
|
// 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
|
// for the newly resized grid. It is better mark everything as dirty and
|
||||||
// send all the updates.
|
// send all the updates.
|
||||||
int dirty_first = grid->was_resized ? start_col : INT_MAX;
|
int dirty_first = INT_MAX;
|
||||||
int dirty_last = grid->was_resized ? grid->Columns : 0;
|
int dirty_last = 0;
|
||||||
|
|
||||||
int col = start_col;
|
int col = start_col;
|
||||||
schar_from_char(sc, c1);
|
schar_from_char(sc, c1);
|
||||||
@@ -5912,10 +5912,8 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
|
|||||||
if (dirty_first == INT_MAX) {
|
if (dirty_first == INT_MAX) {
|
||||||
dirty_first = col;
|
dirty_first = col;
|
||||||
}
|
}
|
||||||
if (!grid->was_resized) {
|
|
||||||
dirty_last = col+1;
|
dirty_last = col+1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (col == start_col) {
|
if (col == start_col) {
|
||||||
schar_from_char(sc, c2);
|
schar_from_char(sc, c2);
|
||||||
}
|
}
|
||||||
@@ -6152,7 +6150,7 @@ retry:
|
|||||||
|
|
||||||
void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy)
|
void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy)
|
||||||
{
|
{
|
||||||
int new_row, old_row;
|
int new_row;
|
||||||
ScreenGrid new = *grid;
|
ScreenGrid new = *grid;
|
||||||
|
|
||||||
size_t ncells = (size_t)((rows+1) * columns);
|
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.LineOffset[new_row] = new_row * new.Columns;
|
||||||
new.LineWraps[new_row] = false;
|
new.LineWraps[new_row] = false;
|
||||||
|
|
||||||
grid_clear_line(&new, 0, columns);
|
grid_clear_line(&new, new.LineOffset[new_row], columns, true);
|
||||||
|
|
||||||
if (copy) {
|
if (copy) {
|
||||||
// If the screen is not going to be cleared, copy as much as
|
// 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
|
// possible from the old screen to the new one and clear the rest
|
||||||
// (used when resizing the window at the "--more--" prompt or when
|
// (used when resizing the window at the "--more--" prompt or when
|
||||||
// executing an external command, for the GUI).
|
// executing an external command, for the GUI).
|
||||||
old_row = new_row + (grid->Rows - new.Rows);
|
if (new_row < grid->Rows && grid->ScreenLines != NULL) {
|
||||||
if (old_row >= 0 && grid->ScreenLines != NULL) {
|
|
||||||
int len = MIN(grid->Columns, new.Columns);
|
int len = MIN(grid->Columns, new.Columns);
|
||||||
memmove(new.ScreenLines + new.LineOffset[new_row],
|
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));
|
(size_t)len * sizeof(schar_T));
|
||||||
memmove(new.ScreenAttrs + new.LineOffset[new_row],
|
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));
|
(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
|
/// clear a line in the grid starting at "off" until "width" characters
|
||||||
/// are cleared.
|
/// 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++) {
|
for (int col = 0; col < width; col++) {
|
||||||
schar_from_ascii(grid->ScreenLines[off + col], ' ');
|
schar_from_ascii(grid->ScreenLines[off + col], ' ');
|
||||||
|
Reference in New Issue
Block a user