Skip to content

Commit 65fcabe

Browse files
committed
Change ui_line to use window grids and not global grid
1 parent cb22b75 commit 65fcabe

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
@@ -4433,17 +4433,17 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44334433
schar_T sc;
44344434
schar_from_char(sc, c);
44354435

4436-
if (schar_cmp(grid->ScreenLines[off_to], sc)
4437-
|| grid->ScreenAttrs[off_to] != hl) {
4438-
schar_copy(grid->ScreenLines[off_to], sc);
4439-
grid->ScreenAttrs[off_to] = hl;
4436+
if (schar_cmp(default_grid.ScreenLines[off_to], sc)
4437+
|| default_grid.ScreenAttrs[off_to] != hl) {
4438+
schar_copy(default_grid.ScreenLines[off_to], sc);
4439+
default_grid.ScreenAttrs[off_to] = hl;
44404440
if (start_dirty == -1) {
44414441
start_dirty = col;
44424442
}
44434443
end_dirty = col+1;
44444444
}
44454445
} else
4446-
grid->LineWraps[row] = FALSE;
4446+
default_grid.LineWraps[row] = false;
44474447
}
44484448

44494449
if (clear_end < end_dirty) {
@@ -4453,7 +4453,7 @@ static void grid_move_line(ScreenGrid *grid, int row, int coloff, int endcol,
44534453
start_dirty = end_dirty;
44544454
}
44554455
if (clear_end > start_dirty) {
4456-
ui_line(row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
4456+
ui_line(grid, row, coloff+start_dirty, coloff+end_dirty, coloff+clear_end,
44574457
bg_attr);
44584458
}
44594459
}
@@ -5417,7 +5417,7 @@ void screen_puts_line_flush(bool set_cursor)
54175417
if (set_cursor) {
54185418
ui_cursor_goto(put_dirty_row, put_dirty_last);
54195419
}
5420-
ui_line(put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
5420+
ui_line(&default_grid, put_dirty_row, put_dirty_first, put_dirty_last, put_dirty_last, 0);
54215421
put_dirty_first = -1;
54225422
put_dirty_last = 0;
54235423
}
@@ -5778,16 +5778,16 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
57785778
put_dirty_last = MAX(put_dirty_last, dirty_last);
57795779
} else {
57805780
int last = c2 != ' ' ? dirty_last : dirty_first + (c1 != ' ');
5781-
ui_line(row, dirty_first, last, dirty_last, attr);
5781+
ui_line(grid, row, dirty_first, last, dirty_last, attr);
57825782
}
57835783
}
57845784

5785-
if (end_col == grid->Columns) {
5785+
if (end_col == Columns) {
57865786
grid->LineWraps[row] = false;
57875787
}
57885788

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

7052-
Rows = default_grid.Rows;
7053-
Columns = default_grid.Columns;
7052+
default_grid.Rows = screen_Rows;
7053+
default_grid.Columns = screen_Columns;
70547054

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