comparison src/testdir/test_textprop.vim @ 29676:b4fea827c20a v9.0.0178

patch 9.0.0178: cursor position wrong with virtual text before Tab Commit: https://github.com/vim/vim/commit/e428fa04a758cc87ea580c856a796e58e407504b Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 9 16:55:41 2022 +0100 patch 9.0.0178: cursor position wrong with virtual text before Tab Problem: Cursor position wrong with virtual text before Tab. Solution: Use the byte length, not the cell with, to compare the column. Correct tab size after text prop. (closes #10866)
author Bram Moolenaar <Bram@vim.org>
date Tue, 09 Aug 2022 18:00:03 +0200
parents e44dbb22864d
children fc0f93590fd4
comparison
equal deleted inserted replaced
29675:51b072a13be4 29676:b4fea827c20a
972 call assert_equal(1491, line2byte(401)) 972 call assert_equal(1491, line2byte(401))
973 2delete 973 2delete
974 call assert_equal(1489, line2byte(400)) 974 call assert_equal(1489, line2byte(400))
975 bwipe! 975 bwipe!
976 976
977 call ch_logfile('logfile', 'w')
977 " Add many lines so that the data block is split. 978 " Add many lines so that the data block is split.
978 " With and without props should give the same result. 979 " With and without props should give the same result.
979 call Run_test_with_line2byte(0) 980 call Run_test_with_line2byte(0)
980 call Run_test_with_line2byte(1) 981 call Run_test_with_line2byte(1)
982 call ch_logfile('', 'w')
981 983
982 call prop_type_delete('comment') 984 call prop_type_delete('comment')
983 endfunc 985 endfunc
984 986
985 func Test_prop_byte2line() 987 func Test_prop_byte2line()
1889 let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10}) 1891 let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10})
1890 call VerifyScreenDump(buf, 'Test_prop_after_tab', {}) 1892 call VerifyScreenDump(buf, 'Test_prop_after_tab', {})
1891 1893
1892 call StopVimInTerminal(buf) 1894 call StopVimInTerminal(buf)
1893 call delete('XscriptPropAfterTab') 1895 call delete('XscriptPropAfterTab')
1896 endfunc
1897
1898 func Test_prop_before_tab()
1899 CheckRunVimInTerminal
1900
1901 let lines =<< trim END
1902 call setline(1, ["\tx"]->repeat(6))
1903 call prop_type_add('test', #{highlight: 'Search'})
1904 call prop_add(1, 1, #{type: 'test', text: '123'})
1905 call prop_add(2, 1, #{type: 'test', text: '1234567'})
1906 call prop_add(3, 1, #{type: 'test', text: '12345678'})
1907 call prop_add(4, 1, #{type: 'test', text: '123456789'})
1908 call prop_add(5, 2, #{type: 'test', text: 'ABC'})
1909 call prop_add(6, 3, #{type: 'test', text: 'ABC'})
1910 normal gg0
1911 END
1912 call writefile(lines, 'XscriptPropBeforeTab')
1913 let buf = RunVimInTerminal('-S XscriptPropBeforeTab', #{rows: 8})
1914 call VerifyScreenDump(buf, 'Test_prop_before_tab_01', {})
1915 call term_sendkeys(buf, "$")
1916 call VerifyScreenDump(buf, 'Test_prop_before_tab_02', {})
1917 call term_sendkeys(buf, "j0")
1918 call VerifyScreenDump(buf, 'Test_prop_before_tab_03', {})
1919 call term_sendkeys(buf, "$")
1920 call VerifyScreenDump(buf, 'Test_prop_before_tab_04', {})
1921 call term_sendkeys(buf, "j0")
1922 call VerifyScreenDump(buf, 'Test_prop_before_tab_05', {})
1923 call term_sendkeys(buf, "$")
1924 call VerifyScreenDump(buf, 'Test_prop_before_tab_06', {})
1925 call term_sendkeys(buf, "j0")
1926 call VerifyScreenDump(buf, 'Test_prop_before_tab_07', {})
1927 call term_sendkeys(buf, "$")
1928 call VerifyScreenDump(buf, 'Test_prop_before_tab_08', {})
1929 call term_sendkeys(buf, "j")
1930 call VerifyScreenDump(buf, 'Test_prop_before_tab_09', {})
1931 call term_sendkeys(buf, "j")
1932 call VerifyScreenDump(buf, 'Test_prop_before_tab_10', {})
1933
1934 call StopVimInTerminal(buf)
1935 call delete('XscriptPropBeforeTab')
1894 endfunc 1936 endfunc
1895 1937
1896 func Test_prop_after_linebreak() 1938 func Test_prop_after_linebreak()
1897 CheckRunVimInTerminal 1939 CheckRunVimInTerminal
1898 1940