patch 9.1.1922: Wrong virtcol('$') with virtual text at EOL

Commit: 
https://github.com/vim/vim/commit/d434f6c2a571e1fda0582986c28a488e1dce8fff
Author: zeertzjq <[email protected]>
Date:   Thu Nov 20 20:35:12 2025 +0000

    patch 9.1.1922: Wrong virtcol('$') with virtual text at EOL
    
    Problem:  Wrong virtcol('$') with virtual text at EOL (rickhowe).
    Solution: Also add 1 to end virtcol when there is virtual text.
              (zeertzjq)
    
    fixes: #18761
    closes: #18762
    
    Signed-off-by: zeertzjq <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/charset.c b/src/charset.c
index 29936e7d9..829ad3720 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1702,8 +1702,7 @@ getvcol(
            {
                incr = 1;       // NUL at end of line only takes one column
 #ifdef FEAT_PROP_POPUP
-               if (cts.cts_cur_text_width > 0)
-                   incr = cts.cts_cur_text_width;
+               incr += cts.cts_cur_text_width;
                on_NUL = TRUE;
 #endif
                break;
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index d33575241..975a5846a 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -4403,6 +4403,22 @@ func Test_text_eol_long_wrap_smoothscroll()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_text_eol_virtcol()
+  new
+  call prop_type_add('test', #{highlight: 'ErrorMsg'})
+  call setline(1, repeat(['1234567890'], 6))
+
+  for [ln, tx] in [[2, 'a'], [3, 'ab'], [4, 'abc'], [5, 'abcd'], [6, 'αβγ口']]
+    let co = col([ln, '$'])
+    call assert_equal(11, virtcol([ln, '$']))
+    call prop_add(ln, co, #{type: 'test', text: tx})
+    call assert_equal(11 + strwidth(tx), virtcol([ln, '$']))
+  endfor
+
+  bwipe!
+  call prop_type_delete('test')
+endfunc
+
 func Test_text_below_nowrap()
   CheckScreendump
   CheckRunVimInTerminal
diff --git a/src/version.c b/src/version.c
index 568aaab9a..fe2371cb1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1922,
 /**/
     1921,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vMBWa-00D6wy-Tq%40256bit.org.

Raspunde prin e-mail lui