aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-22 17:48:53 +0800
committerGitHub <noreply@github.com>2023-06-22 17:48:53 +0800
commit958cc22836f199c90eea680847843574ec54ebfe (patch)
tree30ae82fa3a6f7de8ebc4e9118f593334f5b8a9f8 /src
parent130b8c801a8d7ff93a4eee042ce69488d4877a20 (diff)
downloadrneovim-958cc22836f199c90eea680847843574ec54ebfe.tar.gz
rneovim-958cc22836f199c90eea680847843574ec54ebfe.tar.bz2
rneovim-958cc22836f199c90eea680847843574ec54ebfe.zip
fix(extmarks): empty inline virt_text interfering with DiffText (#24101)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawline.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 463b4c73ae..55f0d69aaf 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -897,14 +897,16 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t
} else {
// already inside existing inline virtual text with multiple chunks
VirtTextChunk vtc = kv_A(wlv->virt_inline, wlv->virt_inline_i);
+ wlv->virt_inline_i++;
wlv->p_extra = vtc.text;
- wlv->n_extra = (int)strlen(wlv->p_extra);
- wlv->extra_for_extmark = true;
+ wlv->n_extra = (int)strlen(vtc.text);
+ if (wlv->n_extra == 0) {
+ continue;
+ }
wlv->c_extra = NUL;
wlv->c_final = NUL;
wlv->extra_attr = vtc.hl_id ? syn_id2attr(vtc.hl_id) : 0;
wlv->n_attr = mb_charlen(vtc.text);
- wlv->virt_inline_i++;
// If the text didn't reach until the first window
// column we need to skip cells.
if (wlv->skip_cells > 0) {
@@ -925,11 +927,12 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t
wlv->skipped_cells += virt_text_len;
wlv->n_attr = 0;
wlv->n_extra = 0;
-
// go to the start so the next virtual text chunk can be selected.
continue;
}
}
+ assert(wlv->n_extra > 0);
+ wlv->extra_for_extmark = true;
}
}
}