Skip to content

Commit c896601

Browse files
coditvabfredl
authored andcommitted
Change ui_line to use window grids and not global grid
1 parent c29f2ae commit c896601

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/nvim/screen.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -4435,17 +4435,17 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44354435
schar_T sc;
44364436
schar_from_char(sc, c);
44374437

4438-
if (schar_cmp(grid->ScreenLines[off_to], sc)
4439-
|| grid->ScreenAttrs[off_to] != hl) {
4440-
schar_copy(grid->ScreenLines[off_to], sc);
4441-
grid->ScreenAttrs[off_to] = hl;
4438+
if (schar_cmp(default_grid.ScreenLines[off_to], sc)
4439+
|| default_grid.ScreenAttrs[off_to] != hl) {
4440+
schar_copy(default_grid.ScreenLines[off_to], sc);
4441+
default_grid.ScreenAttrs[off_to] = hl;
44424442
if (start_dirty == -1) {
44434443
start_dirty = col;
44444444
}
44454445
end_dirty = col+1;
44464446
}
44474447
} else
4448-
grid->LineWraps[row] = FALSE;
4448+
default_grid.LineWraps[row] = false;
44494449
}
44504450

44514451
if (clear_end < end_dirty) {
@@ -4455,7 +4455,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44554455
start_dirty = end_dirty;
44564456
}
44574457
if (clear_end > start_dirty) {
4458-
ui_line(row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
4458+
ui_line(grid, row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
44594459
bg_attr);
44604460
}
44614461
}
@@ -5419,7 +5419,7 @@ void screen_puts_line_flush(bool set_cursor)
54195419
if (set_cursor) {
54205420
ui_cursor_goto(put_dirty_row, put_dirty_last);
54215421
}
5422-
ui_line(put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
5422+
ui_line(&default_grid, put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
54235423
put_dirty_first = -1;
54245424
put_dirty_last = 0;
54255425
}
@@ -5780,16 +5780,16 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
57805780
put_dirty_last = MAX(put_dirty_last, dirty_last);
57815781
} else {
57825782
int last = c2 != ' ' ? dirty_last : dirty_first + (c1 != ' ');
5783-
ui_line(row, dirty_first, last, dirty_last, attr);
5783+
ui_line(grid, row, dirty_first, last, dirty_last, attr);
57845784
}
57855785
}
57865786

5787-
if (end_col == grid->Columns) {
5787+
if (end_col == Columns) {
57885788
grid->LineWraps[row] = false;
57895789
}
57905790

57915791
// TODO(bfredl): The relevant caller should do this
5792-
if (row == Rows - 1) { // overwritten the command line
5792+
if (row == grid->Rows - 1) { // overwritten the command line
57935793
redraw_cmdline = true;
57945794
if (c1 == ' ' && c2 == ' ') {
57955795
clear_cmdline = false; // command line has been cleared
@@ -7051,8 +7051,8 @@ void screen_resize(int width, int height)
70517051
width = Columns;
70527052
ui_resize(width, height);
70537053

7054-
Rows = default_grid.Rows;
7055-
Columns = default_grid.Columns;
7054+
default_grid.Rows = screen_Rows;
7055+
default_grid.Columns = screen_Columns;
70567056

70577057
/* The window layout used to be adjusted here, but it now happens in
70587058
* screenalloc() (also invoked from screenclear()). That is because the

src/nvim/ui.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,14 @@ void ui_set_ext_option(UI *ui, UIExtension ext, bool active)
314314
}
315315
}
316316

317-
void ui_line(int row, int startcol, int endcol, int clearcol, int clearattr)
317+
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol, int clearattr)
318318
{
319-
size_t off = LineOffset[row]+(size_t)startcol;
320-
UI_CALL(raw_line, 1, row, startcol, endcol, clearcol, clearattr,
321-
(const schar_T *)ScreenLines+off, (const sattr_T *)ScreenAttrs+off);
319+
size_t off = grid->LineOffset[row] + (size_t)startcol;
320+
UI_CALL(raw_line, 1, grid->OffsetRow + row, grid->OffsetColumn + startcol,
321+
grid->OffsetColumn + endcol, grid->OffsetColumn + clearcol,
322+
clearattr, (const schar_T *)grid->ScreenLines + off,
323+
(const schar_T *)grid->ScreenAttrs + off);
324+
322325
if (p_wd) { // 'writedelay': flush & delay each time.
323326
int old_row = row, old_col = col;
324327
// If'writedelay is active, we set the cursor to highlight what was drawn

0 commit comments

Comments
 (0)