refactor(message): simplify msg_puts_display and use batched grid updates

msg_puts_display was more complex than necessary in nvim, as in
nvim, it no longer talks directly with a terminal.

In particular we don't need to scroll the grid before emiting the last
char. The TUI already takes care of things like that, for terminals
where it matters.
This commit is contained in:
bfredl
2023-09-30 10:31:55 +02:00
parent 08aea256c8
commit a9a48d6b5f
10 changed files with 152 additions and 255 deletions

View File

@@ -1329,7 +1329,7 @@ static int command_line_execute(VimState *state, int key)
if (!cmd_silent) {
if (!ui_has(kUICmdline)) {
cmd_cursor_goto(msg_row, 0);
msg_cursor_goto(msg_row, 0);
}
ui_flush();
}
@@ -3884,7 +3884,7 @@ void redrawcmd(void)
// when 'incsearch' is set there may be no command line while redrawing
if (ccline.cmdbuff == NULL) {
cmd_cursor_goto(cmdline_row, 0);
msg_cursor_goto(cmdline_row, 0);
msg_clr_eos();
return;
}
@@ -3961,14 +3961,7 @@ void cursorcmd(void)
}
}
cmd_cursor_goto(msg_row, msg_col);
}
static void cmd_cursor_goto(int row, int col)
{
ScreenGrid *grid = &msg_grid_adj;
grid_adjust(&grid, &row, &col);
ui_grid_cursor_goto(grid->handle, row, col);
msg_cursor_goto(msg_row, msg_col);
}
void gotocmdline(bool clr)
@@ -3985,7 +3978,7 @@ void gotocmdline(bool clr)
if (clr) { // clear the bottom line(s)
msg_clr_eos(); // will reset clear_cmdline
}
cmd_cursor_goto(cmdline_row, 0);
msg_cursor_goto(cmdline_row, 0);
}
// Check the word in front of the cursor for an abbreviation.