Skip to content

Commit 200166e

Browse files
committed
Change ui_line to use window grids and not global grid
1 parent bf8e3c0 commit 200166e

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

Diff for: src/nvim/screen.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -4446,17 +4446,17 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44464446
schar_T sc;
44474447
schar_from_char(sc, c);
44484448

4449-
if (schar_cmp(grid->ScreenLines[off_to], sc)
4450-
|| grid->ScreenAttrs[off_to] != hl) {
4451-
schar_copy(grid->ScreenLines[off_to], sc);
4452-
grid->ScreenAttrs[off_to] = hl;
4449+
if (schar_cmp(default_grid.ScreenLines[off_to], sc)
4450+
|| default_grid.ScreenAttrs[off_to] != hl) {
4451+
schar_copy(default_grid.ScreenLines[off_to], sc);
4452+
default_grid.ScreenAttrs[off_to] = hl;
44534453
if (start_dirty == -1) {
44544454
start_dirty = col;
44554455
}
44564456
end_dirty = col+1;
44574457
}
44584458
} else
4459-
grid->LineWraps[row] = FALSE;
4459+
default_grid.LineWraps[row] = false;
44604460
}
44614461

44624462
if (clear_end < end_dirty) {
@@ -4466,7 +4466,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44664466
start_dirty = end_dirty;
44674467
}
44684468
if (clear_end > start_dirty) {
4469-
ui_line(row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
4469+
ui_line(grid, row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
44704470
bg_attr);
44714471
}
44724472
}
@@ -5432,7 +5432,7 @@ void screen_puts_line_flush(bool set_cursor)
54325432
if (set_cursor) {
54335433
ui_cursor_goto(put_dirty_row, put_dirty_last);
54345434
}
5435-
ui_line(put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
5435+
ui_line(&default_grid, put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
54365436
put_dirty_first = -1;
54375437
put_dirty_last = 0;
54385438
}
@@ -5795,16 +5795,16 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
57955795
put_dirty_last = MAX(put_dirty_last, dirty_last);
57965796
} else {
57975797
int last = c2 != ' ' ? dirty_last : dirty_first + (c1 != ' ');
5798-
ui_line(row, dirty_first, last, dirty_last, attr);
5798+
ui_line(grid, row, dirty_first, last, dirty_last, attr);
57995799
}
58005800
}
58015801

5802-
if (end_col == grid->Columns) {
5802+
if (end_col == Columns) {
58035803
grid->LineWraps[row] = false;
58045804
}
58055805

58065806
// TODO(bfredl): The relevant caller should do this
5807-
if (row == Rows - 1) { // overwritten the command line
5807+
if (row == default_grid.Rows - 1) { // overwritten the command line
58085808
redraw_cmdline = true;
58095809
if (start_col == 0 && end_col == Columns
58105810
&& c1 == ' ' && c2 == ' ' && attr == 0) {
@@ -7067,8 +7067,8 @@ void screen_resize(int width, int height)
70677067
width = Columns;
70687068
ui_resize(width, height);
70697069

7070-
Rows = default_grid.Rows;
7071-
Columns = default_grid.Columns;
7070+
default_grid.Rows = screen_Rows;
7071+
default_grid.Columns = screen_Columns;
70727072

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

Diff for: src/nvim/ui.c

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

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

0 commit comments

Comments
 (0)