comparison src/testdir/test_textprop.vim @ 33017:7d0357f70cf8 v9.0.1800

patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text Commit: https://github.com/vim/vim/commit/6a3897232aecd3e8b9e8b23955e55c1993e5baec Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Aug 27 19:04:14 2023 +0200 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text Problem: Cursor position still wrong with 'showbreak' and virtual text after last character or 'listchars' "eol". Solution: Remove unnecessary w_wcol adjustment in curs_columns(). Also fix first char of virtual text not shown at the start of a screen line. closes: #12478 closes: #12532 closes: #12904 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 27 Aug 2023 19:15:05 +0200
parents bc3b293a965c
children 2b47322be0d1
comparison
equal deleted inserted replaced
33016:0af63fa799bf 33017:7d0357f70cf8
2684 func Run_test_prop_inserts_text_showbreak(cmd) 2684 func Run_test_prop_inserts_text_showbreak(cmd)
2685 CheckRunVimInTerminal 2685 CheckRunVimInTerminal
2686 2686
2687 let lines =<< trim END 2687 let lines =<< trim END
2688 highlight! link LineNr Normal 2688 highlight! link LineNr Normal
2689 setlocal number showbreak=+ breakindent breakindentopt=shift:2
2690 setlocal scrolloff=0 smoothscroll
2689 call setline(1, repeat('a', 28)) 2691 call setline(1, repeat('a', 28))
2690 call prop_type_add('theprop', #{highlight: 'Special'}) 2692 call prop_type_add('theprop', #{highlight: 'Special'})
2691 call prop_add(1, 28, #{type: 'theprop', text: repeat('123', 23), text_wrap: 'wrap'}) 2693 call prop_add(1, 28, #{type: 'theprop', text: repeat('123', 23), text_wrap: 'wrap'})
2692 setlocal number showbreak=+ breakindent breakindentopt=shift:2
2693 setlocal scrolloff=0 smoothscroll
2694 normal! $ 2694 normal! $
2695 END 2695 END
2696 let lines = insert(lines, a:cmd) 2696 let lines = insert(lines, a:cmd)
2697 call writefile(lines, 'XscriptPropsShowbreak', 'D') 2697 call writefile(lines, 'XscriptPropsShowbreak', 'D')
2698 let buf = RunVimInTerminal('-S XscriptPropsShowbreak', #{rows: 6, cols: 30}) 2698 let buf = RunVimInTerminal('-S XscriptPropsShowbreak', #{rows: 6, cols: 30})
2738 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_20', {}) 2738 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_20', {})
2739 call term_sendkeys(buf, "\<C-E>") 2739 call term_sendkeys(buf, "\<C-E>")
2740 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_21', {}) 2740 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_21', {})
2741 call term_sendkeys(buf, "zbx") 2741 call term_sendkeys(buf, "zbx")
2742 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_22', {}) 2742 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_22', {})
2743 call term_sendkeys(buf, "26ia\<Esc>a")
2744 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_23', {})
2745 call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal breakindentopt=\<CR>")
2746 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_24', {})
2743 2747
2744 call StopVimInTerminal(buf) 2748 call StopVimInTerminal(buf)
2745 endfunc 2749 endfunc
2746 2750
2747 func Test_prop_inserts_text_showbreak() 2751 func Test_prop_inserts_text_showbreak()
2752 2756
2753 func Test_prop_before_tab_skipcol() 2757 func Test_prop_before_tab_skipcol()
2754 CheckRunVimInTerminal 2758 CheckRunVimInTerminal
2755 2759
2756 let lines =<< trim END 2760 let lines =<< trim END
2761 setlocal list listchars=tab:<-> scrolloff=0 smoothscroll
2757 call setline(1, repeat("\t", 4) .. 'a') 2762 call setline(1, repeat("\t", 4) .. 'a')
2758 call prop_type_add('theprop', #{highlight: 'Special'}) 2763 call prop_type_add('theprop', #{highlight: 'Special'})
2759 call prop_add(1, 4, #{type: 'theprop', text: repeat('12', 32), text_wrap: 'wrap'}) 2764 call prop_add(1, 4, #{type: 'theprop', text: repeat('12', 32), text_wrap: 'wrap'})
2760 setlocal list listchars=tab:<-> scrolloff=0 smoothscroll
2761 normal! $ 2765 normal! $
2762 END 2766 END
2763 call writefile(lines, 'XscriptPropsBeforeTabSkipcol', 'D') 2767 call writefile(lines, 'XscriptPropsBeforeTabSkipcol', 'D')
2764 let buf = RunVimInTerminal('-S XscriptPropsBeforeTabSkipcol', #{rows: 6, cols: 30}) 2768 let buf = RunVimInTerminal('-S XscriptPropsBeforeTabSkipcol', #{rows: 6, cols: 30})
2765 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_1', {}) 2769 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_1', {})
2781 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_9', {}) 2785 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_9', {})
2782 call term_sendkeys(buf, "\<C-E>") 2786 call term_sendkeys(buf, "\<C-E>")
2783 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_10', {}) 2787 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_10', {})
2784 call term_sendkeys(buf, "\<C-E>") 2788 call term_sendkeys(buf, "\<C-E>")
2785 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_11', {}) 2789 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_11', {})
2790
2791 call StopVimInTerminal(buf)
2792 endfunc
2793
2794 func Test_prop_inserts_text_lcs_extends()
2795 CheckRunVimInTerminal
2796
2797 let lines =<< trim END
2798 setlocal nowrap list listchars=extends:!
2799 call setline(1, repeat('a', &columns + 1))
2800 call prop_type_add('theprop', #{highlight: 'Special'})
2801 call prop_add(1, &columns + 2, #{type: 'theprop', text: 'bbb'})
2802 END
2803 call writefile(lines, 'XscriptPropsListExtends', 'D')
2804 let buf = RunVimInTerminal('-S XscriptPropsListExtends', #{rows: 3, cols: 50})
2805 call term_sendkeys(buf, '20l')
2806 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_1', {})
2807 call term_sendkeys(buf, 'zl')
2808 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_2', {})
2809 call term_sendkeys(buf, 'zl')
2810 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_3', {})
2811 call term_sendkeys(buf, 'zl')
2812 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_4', {})
2813 call term_sendkeys(buf, 'zl')
2814 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_5', {})
2786 2815
2787 call StopVimInTerminal(buf) 2816 call StopVimInTerminal(buf)
2788 endfunc 2817 endfunc
2789 2818
2790 func Test_prop_add_with_text_fails() 2819 func Test_prop_add_with_text_fails()