[vim/vim] Move screen invalid unicode prop text (Issue #19395)

3 views
Skip to first unread message

A4-Tacks

unread,
Feb 13, 2026, 10:00:15 AM (yesterday) Feb 13
to vim/vim, Subscribed
A4-Tacks created an issue (vim/vim#19395)

mini-vimrc.vim:

set nowrap

Vim version: 9.1.2077

Reproduction steps:

  1. Run Vim -Nu mini-vimrc.vim
  2. Input 100Ix <esc>
  3. Input :echo prop_type_add("foo", {}) | echo prop_add(1, 1, #{text:repeat("…", 70),type:"foo"}) <cr>
  4. Input 100Iy <esc>
  5. Input 0150zl

On first line first column, displayed to (U+FFFD)


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19395@github.com>

Christian Brabandt

unread,
Feb 13, 2026, 2:23:44 PM (yesterday) Feb 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19395)

Yeah, it looks like side scrolling does not correctly redraw the text properties. But a manual redraw <Ctrl-L> fixes it


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19395/3898966148@github.com>

zeertzjq

unread,
Feb 13, 2026, 7:17:39 PM (23 hours ago) Feb 13
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19395)

IIRC I tried to fix the before:

diff --git a/src/drawline.c b/src/drawline.c
index ef776dc20..2a9abe8e5 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2357,22 +2357,33 @@ win_line(
 			// column we need to skip cells.
 			if (skip_cells > 0)
 			{
-			    if (wlv.n_extra > skip_cells)
+			    int virt_text_width = mb_string2cells(wlv.p_extra, -1);
+			    if (virt_text_width > skip_cells)
 			    {
-				wlv.n_extra -= skip_cells;
-				wlv.p_extra += skip_cells;
-				wlv.n_attr_skip -= skip_cells;
+				int skip_cells_remaining = skip_cells;
+				// Skip cells in the text.
+				while (skip_cells_remaining > 0)
+				{
+				    int cells = (*mb_ptr2cells)(wlv.p_extra);
+				    if (cells > skip_cells_remaining)
+					break;
+				    int c_len = (*mb_ptr2len)(wlv.p_extra);
+				    skip_cells_remaining -= cells;
+				    wlv.p_extra += c_len;
+				    wlv.n_extra -= c_len;
+				    wlv.n_attr_skip--;
+				}
 				if (wlv.n_attr_skip < 0)
 				    wlv.n_attr_skip = 0;
-				skipped_cells += skip_cells;
-				skip_cells = 0;
+				skipped_cells += skip_cells - skip_cells_remaining;
+				skip_cells = skip_cells_remaining;
 			    }
 			    else
 			    {
 				// the whole text is left of the window, drop
 				// it and advance to the next one
-				skip_cells -= wlv.n_extra;
-				skipped_cells += wlv.n_extra;
+				skip_cells -= virt_text_width;
+				skipped_cells += virt_text_width;
 				wlv.n_extra = 0;
 				wlv.n_attr_skip = 0;
 				bail_out = TRUE;

But I didn't fully understand the purpose of n_attr_skip and forgot about it.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19395/3900230981@github.com>

Reply all
Reply to author
Forward
0 new messages