Skip to content

Commit 08a83a0

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.1124: No test for 'listchars' "precedes" with double-width char
Problem: No test for 'listchars' "precedes" with double-width char. Solution: Add a test and fix a typo in code (zeertzjq). closes: #16675 Signed-off-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent e700dde commit 08a83a0

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/drawline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3718,7 +3718,7 @@ win_line(
37183718
#endif
37193719
// Handle the case where we are in column 0 but not on the first
37203720
// character of the line and the user wants us to show us a
3721-
// special character (via 'listchars' option "precedes:<char>".
3721+
// special character (via 'listchars' option "precedes:<char>").
37223722
if (lcs_prec_todo != NUL
37233723
&& wp->w_p_list
37243724
&& (wp->w_p_wrap ? (wp->w_skipcol > 0 && wlv.row == 0)

src/testdir/test_listchars.vim

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,5 +671,34 @@ func Test_listchars_foldcolumn()
671671
call StopVimInTerminal(buf)
672672
endfunc
673673

674+
func Test_listchars_precedes_with_wide_char()
675+
new
676+
setlocal nowrap list listchars=eol:$,precedes:!
677+
call setline(1, '123口456')
678+
call assert_equal(['123口456$ '], ScreenLines(1, 10))
679+
let attr = screenattr(1, 9)
680+
normal! zl
681+
call assert_equal(['!3口456$ '], ScreenLines(1, 10))
682+
call assert_equal(attr, screenattr(1, 1))
683+
normal! zl
684+
call assert_equal(['!口456$ '], ScreenLines(1, 10))
685+
call assert_equal(attr, screenattr(1, 1))
686+
normal! zl
687+
call assert_equal(['!<456$ '], ScreenLines(1, 10))
688+
call assert_equal(attr, screenattr(1, 1))
689+
call assert_equal(attr, screenattr(1, 2))
690+
normal! zl
691+
" TODO: should it be '!' instead of '<' here?
692+
call assert_equal(['<456$ '], ScreenLines(1, 10))
693+
call assert_equal(attr, screenattr(1, 1))
694+
normal! zl
695+
call assert_equal(['!56$ '], ScreenLines(1, 10))
696+
call assert_equal(attr, screenattr(1, 1))
697+
normal! zl
698+
call assert_equal(['!6$ '], ScreenLines(1, 10))
699+
call assert_equal(attr, screenattr(1, 1))
700+
701+
bw!
702+
endfunc
674703

675704
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

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

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1124,
707709
/**/
708710
1123,
709711
/**/

0 commit comments

Comments
 (0)