Skip to content

Commit 0d32916

Browse files
committed
Change ui_line to use window grids and not global grid
1 parent 3d1fe94 commit 0d32916

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

src/nvim/screen.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -4413,17 +4413,17 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44134413
schar_T sc;
44144414
schar_from_char(sc, c);
44154415

4416-
if (schar_cmp(grid->ScreenLines[off_to], sc)
4417-
|| grid->ScreenAttrs[off_to] != hl) {
4418-
schar_copy(grid->ScreenLines[off_to], sc);
4419-
grid->ScreenAttrs[off_to] = hl;
4416+
if (schar_cmp(default_grid.ScreenLines[off_to], sc)
4417+
|| default_grid.ScreenAttrs[off_to] != hl) {
4418+
schar_copy(default_grid.ScreenLines[off_to], sc);
4419+
default_grid.ScreenAttrs[off_to] = hl;
44204420
if (start_dirty == -1) {
44214421
start_dirty = col;
44224422
}
44234423
end_dirty = col+1;
44244424
}
44254425
} else
4426-
grid->LineWraps[row] = FALSE;
4426+
default_grid.LineWraps[row] = false;
44274427
}
44284428

44294429
if (clear_end < end_dirty) {
@@ -4433,7 +4433,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44334433
start_dirty = end_dirty;
44344434
}
44354435
if (clear_end > start_dirty) {
4436-
ui_line(row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
4436+
ui_line(grid, row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
44374437
bg_attr);
44384438
}
44394439
}
@@ -5393,7 +5393,7 @@ void screen_puts_line_flush(bool set_cursor)
53935393
if (set_cursor || p_wd) {
53945394
ui_cursor_goto(put_dirty_row, put_dirty_last);
53955395
}
5396-
ui_line(put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
5396+
ui_line(&default_grid, put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
53975397
put_dirty_first = -1;
53985398
put_dirty_last = 0;
53995399
}
@@ -5754,16 +5754,16 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
57545754
put_dirty_last = MAX(put_dirty_last, dirty_last);
57555755
} else {
57565756
int last = c2 != ' ' ? dirty_last : dirty_first + (c1 != ' ');
5757-
ui_line(row, dirty_first, last, dirty_last, attr);
5757+
ui_line(grid, row, dirty_first, last, dirty_last, attr);
57585758
}
57595759
}
57605760

5761-
if (end_col == grid->Columns) {
5761+
if (end_col == Columns) {
57625762
grid->LineWraps[row] = false;
57635763
}
57645764

57655765
// TODO(bfredl): this is ugly, the relevant caller should do this
5766-
if (row == default_grid.Rows - 1) { // overwritten the command line
5766+
if (row == grid->Rows - 1) { // overwritten the command line
57675767
redraw_cmdline = true;
57685768
if (c1 == ' ' && c2 == ' ') {
57695769
clear_cmdline = false; // command line has been cleared
@@ -7015,8 +7015,8 @@ void screen_resize(int width, int height)
70157015
width = Columns;
70167016
ui_resize(width, height);
70177017

7018-
Rows = default_grid.Rows;
7019-
Columns = default_grid.Columns;
7018+
default_grid.Rows = screen_Rows;
7019+
default_grid.Columns = screen_Columns;
70207020

70217021
// TODO(bfredl): update default colors when they changed, NOT on resize.
70227022
ui_default_colors_set();

src/nvim/ui.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,19 @@ void ui_set_ext_option(UI *ui, UIExtension ext, bool active)
312312
}
313313
}
314314

315-
void ui_line(int row, int startcol, int endcol, int clearcol, int clearattr)
315+
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol, int clearattr)
316316
{
317-
size_t off = LineOffset[row]+(size_t)startcol;
318-
UI_CALL(raw_line, 1, row, startcol, endcol, clearcol, clearattr,
319-
ScreenLines+off, ScreenAttrs+off);
317+
size_t off = grid->LineOffset[row] + (size_t)startcol;
318+
319+
UI_CALL(raw_line, 1,
320+
grid->OffsetRow + row,
321+
grid->OffsetColumn + startcol,
322+
grid->OffsetColumn + endcol,
323+
grid->OffsetColumn + clearcol,
324+
clearattr,
325+
grid->ScreenLines + off,
326+
grid->ScreenAttrs + off);
327+
320328
if (p_wd) { // 'writedelay': flush & delay each time.
321329
ui_flush();
322330
uint64_t wd = (uint64_t)labs(p_wd);

0 commit comments

Comments
 (0)