From e33269578b5bea2528cc48afc5b009eb8d4ad1d6 Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 20 Sep 2023 10:08:05 +0200 Subject: refactor(grid): unify the two put-text-on-the-screen code paths The screen grid refactors will continue until morale improves. Jokes aside, this is quite a central installment in the series. Before this refactor, there were two fundamentally distinct codepaths for getting some text on the screen: - the win_line() -> grid_put_linebuf() -> ui_line() call chain used for buffer text, with linebuf_char as a temporary scratch buffer - the grid_line_start/grid_line_puts/grid_line_flush() -> ui_line() path used for every thing else: statuslines, messages and the command line. Here the grid->chars[] array itself doubles as a scratch buffer. With this refactor, the later family of functions still exist, however they now as well render to linebuf_char just like win_line() did, and grid_put_linebuf() is called in the end to calculate delta changes. This means we don't need any duplicate logic for delta calculations anymore. Later down the line, it will be possible to share more logic operating on this scratch buffer, like doing 'rightleft' reversal and arabic shaping as a post-processing step. --- src/nvim/normal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index b6fe24a961..834204e5e1 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2087,7 +2087,7 @@ static void display_showcmd(void) // clear the rest of an old message by outputting up to SHOWCMD_COLS spaces grid_line_puts(sc_col + len, (char *)" " + len, -1, HL_ATTR(HLF_MSG)); - grid_line_flush(false); + grid_line_flush(); } /// When "check" is false, prepare for commands that scroll the window. -- cgit