Skip to content

Commit 5e8ee39

Browse files
committed
Change ui_line to use window grids and not global grid
1 parent 870a1c0 commit 5e8ee39

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
@@ -4440,17 +4440,17 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44404440
schar_T sc;
44414441
schar_from_char(sc, c);
44424442

4443-
if (schar_cmp(grid->ScreenLines[off_to], sc)
4444-
|| grid->ScreenAttrs[off_to] != hl) {
4445-
schar_copy(grid->ScreenLines[off_to], sc);
4446-
grid->ScreenAttrs[off_to] = hl;
4443+
if (schar_cmp(default_grid.ScreenLines[off_to], sc)
4444+
|| default_grid.ScreenAttrs[off_to] != hl) {
4445+
schar_copy(default_grid.ScreenLines[off_to], sc);
4446+
default_grid.ScreenAttrs[off_to] = hl;
44474447
if (start_dirty == -1) {
44484448
start_dirty = col;
44494449
}
44504450
end_dirty = col+1;
44514451
}
44524452
} else
4453-
grid->LineWraps[row] = FALSE;
4453+
default_grid.LineWraps[row] = false;
44544454
}
44554455

44564456
if (clear_end < end_dirty) {
@@ -4460,7 +4460,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44604460
start_dirty = end_dirty;
44614461
}
44624462
if (clear_end > start_dirty) {
4463-
ui_line(row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
4463+
ui_line(grid, row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
44644464
bg_attr);
44654465
}
44664466
}
@@ -5424,7 +5424,7 @@ void screen_puts_line_flush(bool set_cursor)
54245424
if (set_cursor) {
54255425
ui_cursor_goto(put_dirty_row, put_dirty_last);
54265426
}
5427-
ui_line(put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
5427+
ui_line(&default_grid, put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
54285428
put_dirty_first = -1;
54295429
put_dirty_last = 0;
54305430
}
@@ -5785,16 +5785,16 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
57855785
put_dirty_last = MAX(put_dirty_last, dirty_last);
57865786
} else {
57875787
int last = c2 != ' ' ? dirty_last : dirty_first + (c1 != ' ');
5788-
ui_line(row, dirty_first, last, dirty_last, attr);
5788+
ui_line(grid, row, dirty_first, last, dirty_last, attr);
57895789
}
57905790
}
57915791

5792-
if (end_col == grid->Columns) {
5792+
if (end_col == Columns) {
57935793
grid->LineWraps[row] = false;
57945794
}
57955795

57965796
// TODO(bfredl): The relevant caller should do this
5797-
if (row == Rows - 1) { // overwritten the command line
5797+
if (row == grid->Rows - 1) { // overwritten the command line
57985798
redraw_cmdline = true;
57995799
if (c1 == ' ' && c2 == ' ') {
58005800
clear_cmdline = false; // command line has been cleared
@@ -7056,8 +7056,8 @@ void screen_resize(int width, int height)
70567056
width = Columns;
70577057
ui_resize(width, height);
70587058

7059-
Rows = default_grid.Rows;
7060-
Columns = default_grid.Columns;
7059+
default_grid.Rows = screen_Rows;
7060+
default_grid.Columns = screen_Columns;
70617061

70627062
/* The window layout used to be adjusted here, but it now happens in
70637063
* 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)