diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-22 22:07:34 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-22 22:07:34 +0200 |
commit | b557f4898208105b674df605403cac1b1292707b (patch) | |
tree | 1f488959630dfabef4d8fe87928aeb462b455d32 /src/testdir/test_textprop.vim | |
parent | 171c5b9b0332493faa6caadd8c0d5cf52392d913 (diff) |
patch 9.0.1783: Display issues with virt text smoothscroll and showbreakv9.0.1783
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: #12597
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r-- | src/testdir/test_textprop.vim | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index e7e9eecef7..c272f2e5d0 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -2630,6 +2630,110 @@ func Test_prop_inserts_text_visual_block() call StopVimInTerminal(buf) endfunc +func Run_test_prop_inserts_text_showbreak(cmd) + CheckRunVimInTerminal + + let lines =<< trim END + highlight! link LineNr Normal + call setline(1, repeat('a', 28)) + call prop_type_add('theprop', #{highlight: 'Special'}) + call prop_add(1, 28, #{type: 'theprop', text: repeat('123', 23), text_wrap: 'wrap'}) + setlocal number showbreak=+ breakindent breakindentopt=shift:2 + setlocal scrolloff=0 smoothscroll + normal! $ + END + let lines = insert(lines, a:cmd) + call writefile(lines, 'XscriptPropsShowbreak', 'D') + let buf = RunVimInTerminal('-S XscriptPropsShowbreak', #{rows: 6, cols: 30}) + call term_sendkeys(buf, ":set noruler\<CR>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_1', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_2', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_3', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_4', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_5', {}) + call term_sendkeys(buf, "zbi") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_6', {}) + call term_sendkeys(buf, "\<BS>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_7', {}) + call term_sendkeys(buf, "\<Esc>l") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_8', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_9', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_10', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_11', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_12', {}) + call term_sendkeys(buf, "023x$") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_13', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_14', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_15', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_16', {}) + call term_sendkeys(buf, "zbi") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_17', {}) + call term_sendkeys(buf, "\<C-U>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_18', {}) + call term_sendkeys(buf, "\<Esc>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_19', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_20', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_21', {}) + + call StopVimInTerminal(buf) +endfunc + +func Test_prop_inserts_text_showbreak() + call Run_test_prop_inserts_text_showbreak('') + " because of 'breakindent' the screendumps are the same + call Run_test_prop_inserts_text_showbreak('set cpoptions+=n') +endfunc + +func Test_prop_before_tab_skipcol() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, repeat("\t", 4) .. 'a') + call prop_type_add('theprop', #{highlight: 'Special'}) + call prop_add(1, 4, #{type: 'theprop', text: repeat('12', 32), text_wrap: 'wrap'}) + setlocal list listchars=tab:<-> scrolloff=0 smoothscroll + normal! $ + END + call writefile(lines, 'XscriptPropsBeforeTabSkipcol', 'D') + let buf = RunVimInTerminal('-S XscriptPropsBeforeTabSkipcol', #{rows: 6, cols: 30}) + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_1', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_2', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_3', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_4', {}) + call term_sendkeys(buf, "zbh") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_5', {}) + call term_sendkeys(buf, "i") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_6', {}) + call term_sendkeys(buf, "\<C-O>:setlocal nolist\<CR>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_7', {}) + call term_sendkeys(buf, "\<Esc>l") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_8', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_9', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_10', {}) + call term_sendkeys(buf, "\<C-E>") + call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_11', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_prop_add_with_text_fails() call prop_type_add('failing', #{highlight: 'ErrorMsg'}) call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') |