Skip to content

Commit d434f6c

Browse files
zeertzjqchrisbra
authored andcommitted
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]>
1 parent 6aac706 commit d434f6c

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/charset.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,7 @@ getvcol(
17021702
{
17031703
incr = 1; // NUL at end of line only takes one column
17041704
#ifdef FEAT_PROP_POPUP
1705-
if (cts.cts_cur_text_width > 0)
1706-
incr = cts.cts_cur_text_width;
1705+
incr += cts.cts_cur_text_width;
17071706
on_NUL = TRUE;
17081707
#endif
17091708
break;

src/testdir/test_textprop.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4403,6 +4403,22 @@ func Test_text_eol_long_wrap_smoothscroll()
44034403
call StopVimInTerminal(buf)
44044404
endfunc
44054405

4406+
func Test_text_eol_virtcol()
4407+
new
4408+
call prop_type_add('test', #{highlight: 'ErrorMsg'})
4409+
call setline(1, repeat(['1234567890'], 6))
4410+
4411+
for [ln, tx] in [[2, 'a'], [3, 'ab'], [4, 'abc'], [5, 'abcd'], [6, 'αβγ口']]
4412+
let co = col([ln, '$'])
4413+
call assert_equal(11, virtcol([ln, '$']))
4414+
call prop_add(ln, co, #{type: 'test', text: tx})
4415+
call assert_equal(11 + strwidth(tx), virtcol([ln, '$']))
4416+
endfor
4417+
4418+
bwipe!
4419+
call prop_type_delete('test')
4420+
endfunc
4421+
44064422
func Test_text_below_nowrap()
44074423
CheckScreendump
44084424
CheckRunVimInTerminal

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1922,
732734
/**/
733735
1921,
734736
/**/

0 commit comments

Comments
 (0)