mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
refactor(grid): get rid of unbatched grid_puts and grid_putchar
This finalizes the long running refactor from the old TUI-focused grid implementation where text-drawing cursor was not separated from the visible cursor. Still, the pattern of setting cursor position together with updating a line was convenient. Introduce grid_line_cursor_goto() to still allow this but now being explicit about it. Only having batched drawing functions makes code involving drawing a bit longer. But it is better to be explicit, and this highlights cases where multiple small redraws can be grouped together. This was the case for most of the changed places (messages, lastline, and :intro)
This commit is contained in:
@@ -6885,7 +6885,7 @@ static void f_screenchar(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
c = -1;
|
||||
} else {
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
grid_getbytes(grid, row, col, buf, NULL);
|
||||
schar_get(buf, grid_getchar(grid, row, col, NULL));
|
||||
c = utf_ptr2char(buf);
|
||||
}
|
||||
rettv->vval.v_number = c;
|
||||
@@ -6906,7 +6906,7 @@ static void f_screenchars(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
}
|
||||
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
grid_getbytes(grid, row, col, buf, NULL);
|
||||
schar_get(buf, grid_getchar(grid, row, col, NULL));
|
||||
int pcc[MAX_MCO];
|
||||
int c = utfc_ptr2char(buf, pcc);
|
||||
int composing_len = 0;
|
||||
@@ -6951,7 +6951,7 @@ static void f_screenstring(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
|
||||
}
|
||||
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
grid_getbytes(grid, row, col, buf, NULL);
|
||||
schar_get(buf, grid_getchar(grid, row, col, NULL));
|
||||
rettv->vval.v_string = xstrdup(buf);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user