diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-23 10:12:00 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-23 13:17:17 +0800 |
commit | a1d71ad55e0f7149f284178b2d04ac78263b09ff (patch) | |
tree | b20f28212e0fd952a046d0e4150c7c26e54336fc /test/old/testdir | |
parent | 3e80b39a8ef9d33090800642d25fadbd282af337 (diff) | |
download | rneovim-a1d71ad55e0f7149f284178b2d04ac78263b09ff.tar.gz rneovim-a1d71ad55e0f7149f284178b2d04ac78263b09ff.tar.bz2 rneovim-a1d71ad55e0f7149f284178b2d04ac78263b09ff.zip |
vim-patch:9.0.1783: Display issues with virt text smoothscroll and showbreak
Problem: Wrong display with wrapping virtual text or unprintable chars,
'showbreak' and 'smoothscroll'.
Solution: Don't skip cells taken by 'showbreak' in screen lines before
"w_skipcol". Combined "n_skip" and "skip_cells".
closes: vim/vim#12597
https://github.com/vim/vim/commit/b557f4898208105b674df605403cac1b1292707b
Diffstat (limited to 'test/old/testdir')
-rw-r--r-- | test/old/testdir/test_listlbr.vim | 47 | ||||
-rw-r--r-- | test/old/testdir/test_listlbr_utf8.vim | 83 |
2 files changed, 126 insertions, 4 deletions
diff --git a/test/old/testdir/test_listlbr.vim b/test/old/testdir/test_listlbr.vim index 2e66fd4ccb..9b9bf63864 100644 --- a/test/old/testdir/test_listlbr.vim +++ b/test/old/testdir/test_listlbr.vim @@ -14,7 +14,7 @@ function s:screen_lines(lnum, width) abort endfunction func s:compare_lines(expect, actual) - call assert_equal(join(a:expect, "\n"), join(a:actual, "\n")) + call assert_equal(a:expect, a:actual) endfunc function s:test_windows(...) @@ -330,4 +330,47 @@ func Test_list_with_tab_and_skipping_first_chars() \ ] call s:compare_lines(expect, lines) call s:close_windows() -endfu +endfunc + +func Test_ctrl_char_on_wrap_column() + call s:test_windows("setl nolbr wrap sbr=") + call setline(1, 'aaa' .. repeat("\<C-A>", 150) .. 'bbb') + call cursor(1,1) + norm! $ + redraw! + let expect=[ +\ '<<<^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^A^A^A^A^A^A^A^A^A^', +\ 'A^Abbb '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + setl sbr=!! + redraw! + let expect=[ +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^A^A^A^', +\ '!!A^A^A^A^A^A^Abbb '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + call s:close_windows() +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_listlbr_utf8.vim b/test/old/testdir/test_listlbr_utf8.vim index 15b248964f..1bbbd2d2ae 100644 --- a/test/old/testdir/test_listlbr_utf8.vim +++ b/test/old/testdir/test_listlbr_utf8.vim @@ -249,7 +249,6 @@ endfunc func Test_chinese_char_on_wrap_column() call s:test_windows("setl nolbr wrap sbr=") - syntax off call setline(1, [ \ 'aaaaaaaaaaaaaaaaaaa中'. \ 'aaaaaaaaaaaaaaaaa中'. @@ -278,5 +277,85 @@ func Test_chinese_char_on_wrap_column() \ '中hello '] let lines = s:screen_lines([1, 10], winwidth(0)) call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) call s:close_windows() -endfu +endfunc + +func Test_chinese_char_on_wrap_column_sbr() + call s:test_windows("setl nolbr wrap sbr=!!!") + call setline(1, [ +\ 'aaaaaaaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'aaaaaaaaaaaaaa中'. +\ 'hello']) + call cursor(1,1) + norm! $ + redraw! + let expect=[ +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中aaaaaaaaaaaaaa>', +\ '!!!中hello '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + call s:close_windows() +endfunc + +func Test_unprintable_char_on_wrap_column() + call s:test_windows("setl nolbr wrap sbr=") + call setline(1, 'aaa' .. repeat("\uFEFF", 50) .. 'bbb') + call cursor(1,1) + norm! $ + redraw! + let expect=[ +\ '<<<<feff><feff><feff', +\ '><feff><feff><feff><', +\ 'feff><feff><feff><fe', +\ 'ff><feff><feff><feff', +\ '><feff><feff><feff><', +\ 'feff><feff><feff><fe', +\ 'ff><feff><feff><feff', +\ '><feff><feff><feff><', +\ 'feff><feff><feff><fe', +\ 'ff>bbb '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + setl sbr=!! + redraw! + let expect=[ +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff><feff', +\ '!!><feff><feff>bbb '] + let lines = s:screen_lines([1, 10], winwidth(0)) + call s:compare_lines(expect, lines) + call assert_equal(len(expect), winline()) + call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + call s:close_windows() +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |