mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
refactor(grid): properly namespace and separate stateful grid functions
This is a step in an ongoing refactor where the "grid_puts" and "grid_put_linebuf" code paths will share more of the implementation (in particular for delta calculation, doublewidth and 'arabicshape' handling). But it also makes sense by its own as a cleanup, and is thus committed separately. Before this change many of the low level grid functions grid_puts, grid_fill etc could both be used in a standalone fashion but also as part of a batched line update which would be finally transmitted as a single grid_line call (via ui_line() ). This was initially useful to quickly refactor pre-existing vim code to use batched logic safely. However, this pattern is not really helpful for maintainable and newly written code, where the "grid" and "row" arguments are just needlessly repeated. This simplifies these calls to just use grid and row as specified in the initial grid_line_start(grid, row) call. This also makes the intent clear whether any grid_puts() call is actually part of a batch or not, which is better in the long run when more things get refactored to use effective (properly batched) updates.
This commit is contained in:
@@ -1449,6 +1449,7 @@ void edit_putchar(int c, bool highlight)
|
||||
|
||||
// save the character to be able to put it back
|
||||
if (pc_status == PC_STATUS_UNSET) {
|
||||
// TODO(bfredl): save the schar_T instead
|
||||
grid_getbytes(&curwin->w_grid, pc_row, pc_col, pc_bytes, &pc_attr);
|
||||
pc_status = PC_STATUS_SET;
|
||||
}
|
||||
@@ -1532,7 +1533,7 @@ void edit_unputchar(void)
|
||||
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) {
|
||||
redrawWinline(curwin, curwin->w_cursor.lnum);
|
||||
} else {
|
||||
grid_puts(&curwin->w_grid, pc_bytes, pc_row, pc_col, pc_attr);
|
||||
grid_puts(&curwin->w_grid, pc_bytes, -1, pc_row, pc_col, pc_attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3485,7 +3486,8 @@ static bool ins_esc(long *count, int cmdchar, bool nomove)
|
||||
// Otherwise remove the mode message.
|
||||
if (reg_recording != 0 || restart_edit != NUL) {
|
||||
showmode();
|
||||
} else if (p_smd && (got_int || !skip_showmode())) {
|
||||
} else if (p_smd && (got_int || !skip_showmode())
|
||||
&& !(p_ch == 0 && !ui_has(kUIMessages))) {
|
||||
msg("");
|
||||
}
|
||||
// Exit Insert mode
|
||||
|
Reference in New Issue
Block a user