diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-20 08:12:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-20 08:12:45 +0800 |
commit | 4d52b0cf670502caf81b70f2f1e6f8c548b78f58 (patch) | |
tree | 68dd42e89cf0bbcae4f406bd325d50f96efc6d36 /src | |
parent | 52d2851ca4e747146c30e1996c08bf504d99fe95 (diff) | |
download | rneovim-4d52b0cf670502caf81b70f2f1e6f8c548b78f58.tar.gz rneovim-4d52b0cf670502caf81b70f2f1e6f8c548b78f58.tar.bz2 rneovim-4d52b0cf670502caf81b70f2f1e6f8c548b78f58.zip |
fix(showcmd): clear the rest properly (#28420)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/grid.c | 3 | ||||
-rw-r--r-- | src/nvim/normal.c | 8 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/grid.c b/src/nvim/grid.c index f51cdc478a..24a82b7e78 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -436,9 +436,8 @@ int grid_line_puts(int col, const char *text, int textlen, int attr) ? utfc_ptr2schar_len(ptr, (int)((text + len) - ptr), &firstc) : utfc_ptr2schar(ptr, &firstc); int mbyte_cells = utf_char2cells(firstc); - if (mbyte_cells > 2) { + if (mbyte_cells > 2 || schar == 0) { mbyte_cells = 1; - schar = schar_from_char(0xFFFD); } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d90e23240c..2f1477b9d5 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2043,8 +2043,7 @@ void pop_showcmd(void) static void display_showcmd(void) { - int len = vim_strsize(showcmd_buf); - showcmd_is_clear = (len == 0); + showcmd_is_clear = (showcmd_buf[0] == NUL); if (*p_sloc == 's') { if (showcmd_is_clear) { @@ -2069,7 +2068,7 @@ static void display_showcmd(void) if (ui_has(kUIMessages)) { MAXSIZE_TEMP_ARRAY(content, 1); MAXSIZE_TEMP_ARRAY(chunk, 2); - if (len > 0) { + if (!showcmd_is_clear) { // placeholder for future highlight support ADD_C(chunk, INTEGER_OBJ(0)); ADD_C(chunk, CSTR_AS_OBJ(showcmd_buf)); @@ -2086,8 +2085,9 @@ static void display_showcmd(void) int showcmd_row = Rows - 1; grid_line_start(&msg_grid_adj, showcmd_row); + int len = 0; if (!showcmd_is_clear) { - grid_line_puts(sc_col, showcmd_buf, -1, HL_ATTR(HLF_MSG)); + len = grid_line_puts(sc_col, showcmd_buf, -1, HL_ATTR(HLF_MSG)); } // clear the rest of an old message by outputting up to SHOWCMD_COLS spaces |