aboutsummaryrefslogtreecommitdiff
path: root/test/old
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-21 07:02:49 +0800
committerGitHub <noreply@github.com>2025-02-21 07:02:49 +0800
commit99a6cbe5409dc296d6a5597733d92f63d8bca27e (patch)
tree2a1e48e513631d527057b0700e5650172748745a /test/old
parente16bec41b6505678d640755cebe8ec320dec2d45 (diff)
downloadrneovim-99a6cbe5409dc296d6a5597733d92f63d8bca27e.tar.gz
rneovim-99a6cbe5409dc296d6a5597733d92f63d8bca27e.tar.bz2
rneovim-99a6cbe5409dc296d6a5597733d92f63d8bca27e.zip
vim-patch:9.1.1124: No test for 'listchars' "precedes" with double-width char (#32541)
Problem: No test for 'listchars' "precedes" with double-width char. Solution: Add a test and fix a typo in code (zeertzjq). closes: vim/vim#16675 https://github.com/vim/vim/commit/08a83a033a32c0f5bc42eaa63162c21c369cb4ae Cherry-pick test_listchars.vim changes from patch 9.0.0625. Fix a regression from #30014 by moving the mb_schar assignment after the double-width check.
Diffstat (limited to 'test/old')
-rw-r--r--test/old/testdir/test_listchars.vim32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/old/testdir/test_listchars.vim b/test/old/testdir/test_listchars.vim
index b82b70746b..8037abfd91 100644
--- a/test/old/testdir/test_listchars.vim
+++ b/test/old/testdir/test_listchars.vim
@@ -647,7 +647,7 @@ func Test_listchars_foldcolumn()
vsplit
windo set signcolumn=yes foldcolumn=1 winminwidth=0 nowrap list listchars=extends:>,precedes:<
END
- call writefile(lines, 'XTest_listchars')
+ call writefile(lines, 'XTest_listchars', 'D')
let buf = RunVimInTerminal('-S XTest_listchars', {'rows': 10, 'cols': 60})
@@ -670,8 +670,36 @@ func Test_listchars_foldcolumn()
" clean up
call StopVimInTerminal(buf)
- call delete('XTest_listchars')
endfunc
+func Test_listchars_precedes_with_wide_char()
+ new
+ setlocal nowrap list listchars=eol:$,precedes:!
+ 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))
+ normal! zl
+ call assert_equal(['!口456$ '], ScreenLines(1, 10))
+ call assert_equal(attr, screenattr(1, 1))
+ normal! zl
+ call assert_equal(['!<456$ '], ScreenLines(1, 10))
+ 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(attr, screenattr(1, 1))
+ normal! zl
+ call assert_equal(['!56$ '], ScreenLines(1, 10))
+ call assert_equal(attr, screenattr(1, 1))
+ normal! zl
+ call assert_equal(['!6$ '], ScreenLines(1, 10))
+ call assert_equal(attr, screenattr(1, 1))
+
+ bw!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab