vim-patch:9.1.1130: 'listchars' "precedes" is not drawn on Tabs. (#32563)

Problem:  'listchars' "precedes" is not drawn on Tabs.
Solution: Only draw 'listchars' "precedes" when not skipping over cells.
          (zeertzjq)

fixes: vim/vim#5927
closes: vim/vim#16691

13f100e932
This commit is contained in:
zeertzjq
2025-02-22 06:05:32 +08:00
committed by GitHub
parent cbad2c6628
commit 4ff813e5c6
2 changed files with 24 additions and 2 deletions

View File

@@ -2581,6 +2581,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
&& wp->w_p_list
&& (wp->w_p_wrap ? (wp->w_skipcol > 0 && wlv.row == 0) : wp->w_leftcol > 0)
&& wlv.filler_todo <= 0
&& wlv.skip_cells <= 0
&& mb_schar != NUL) {
lcs_prec_todo = NUL;
// TODO(zeertzjq): handle the n_extra > 0 case

View File

@@ -678,6 +678,7 @@ func Test_listchars_precedes_with_wide_char()
call setline(1, '123口456')
call assert_equal(['123口456$ '], ScreenLines(1, 10))
let attr = screenattr(1, 9)
normal! zl
call assert_equal(['!3口456$ '], ScreenLines(1, 10))
call assert_equal(attr, screenattr(1, 1))
@@ -689,8 +690,7 @@ func Test_listchars_precedes_with_wide_char()
call assert_equal(attr, screenattr(1, 1))
call assert_equal(attr, screenattr(1, 2))
normal! zl
" TODO: should it be '!' instead of '<' here?
call assert_equal(['<456$ '], ScreenLines(1, 10))
call assert_equal(['!456$ '], ScreenLines(1, 10))
call assert_equal(attr, screenattr(1, 1))
normal! zl
call assert_equal(['!56$ '], ScreenLines(1, 10))
@@ -702,4 +702,25 @@ func Test_listchars_precedes_with_wide_char()
bw!
endfunc
func Test_listchars_precedes_with_tab()
new
setlocal nowrap list listchars=eol:$,precedes:!,tab:<->
call setline(1, "1234\t56")
let expected_line = '1234<-->56$ '
call assert_equal([expected_line], ScreenLines(1, 12))
let expected_attrs = mapnew(range(1, 12), 'screenattr(1, v:val)')
let attr = expected_attrs[-2]
for i in range(8)
normal! zl
let expected_line = '!' .. expected_line[2:] .. ' '
let expected_attrs = [attr] + expected_attrs[2:] + expected_attrs[-1:]
call assert_equal([expected_line], ScreenLines(1, 12))
let attrs = mapnew(range(1, 12), 'screenattr(1, v:val)')
call assert_equal(expected_attrs, attrs)
endfor
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab