aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-02 18:50:12 +0800
committerGitHub <noreply@github.com>2023-09-02 18:50:12 +0800
commit0c86828ac57429e3dea1bb4a9e686dc4f0dc9ddb (patch)
tree95175aa9d47fefe05ab99c40a7ee008fc52647f8 /src/nvim/api/ui.c
parentbb1df1221d567e3f682a177d55772f49801f5e80 (diff)
downloadrneovim-0c86828ac57429e3dea1bb4a9e686dc4f0dc9ddb.tar.gz
rneovim-0c86828ac57429e3dea1bb4a9e686dc4f0dc9ddb.tar.bz2
rneovim-0c86828ac57429e3dea1bb4a9e686dc4f0dc9ddb.zip
fix(ui): avoid ambiguity about chunk that clears part of line (#24982)
Co-authored-by: bfredl <bjorn.linse@gmail.com>
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 9fa5a89407..891c81d470 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -830,6 +830,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
size_t ncells = (size_t)(endcol - startcol);
int last_hl = -1;
uint32_t nelem = 0;
+ bool was_space = false;
for (size_t i = 0; i < ncells; i++) {
repeat++;
if (i == ncells - 1 || attrs[i] != attrs[i + 1]
@@ -868,9 +869,12 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
data->ncells_pending += MIN(repeat, 2);
last_hl = attrs[i];
repeat = 0;
+ was_space = strequal(chunk[i], " ");
}
}
- if (endcol < clearcol) {
+ // If the last chunk was all spaces, add a clearing chunk even if there are
+ // no more cells to clear, so there is no ambiguity about what to clear.
+ if (endcol < clearcol || was_space) {
nelem++;
data->ncells_pending += 1;
mpack_array(buf, 3);