Mercurial > vim
comparison src/testdir/test_textprop.vim @ 30359:6391b3ca26b7 v9.0.0515
patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Commit: https://github.com/vim/vim/commit/2fdc9b541918237168ca05ac09eb4bb245e5c6c5
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 20 15:59:22 2022 +0100
patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Problem: Virtual text highlight starts too early when 'number' is set.
Solution: Set column offset when wrapping. (issue https://github.com/vim/vim/issues/11138)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Sep 2022 17:00:05 +0200 |
parents | 43d942ff32ce |
children | 748b8dcfba57 |
comparison
equal
deleted
inserted
replaced
30358:7428a54d9770 | 30359:6391b3ca26b7 |
---|---|
1229 \ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>", | 1229 \ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>", |
1230 \ "normal 3G0lli\<BS>\<Esc>", | 1230 \ "normal 3G0lli\<BS>\<Esc>", |
1231 \ "normal 6G0i\<BS>\<Esc>", | 1231 \ "normal 6G0i\<BS>\<Esc>", |
1232 \ "normal 3J", | 1232 \ "normal 3J", |
1233 \ "normal 3G", | 1233 \ "normal 3G", |
1234 \], 'XtestProp') | 1234 \], 'XtestProp', 'D') |
1235 let buf = RunVimInTerminal('-S XtestProp', {'rows': 8}) | 1235 let buf = RunVimInTerminal('-S XtestProp', {'rows': 8}) |
1236 call VerifyScreenDump(buf, 'Test_textprop_01', {}) | 1236 call VerifyScreenDump(buf, 'Test_textprop_01', {}) |
1237 | 1237 |
1238 " clean up | 1238 " clean up |
1239 call StopVimInTerminal(buf) | 1239 call StopVimInTerminal(buf) |
1240 call delete('XtestProp') | |
1241 endfunc | 1240 endfunc |
1242 | 1241 |
1243 func Test_textprop_hl_override() | 1242 func Test_textprop_hl_override() |
1244 CheckScreendump | 1243 CheckScreendump |
1245 | 1244 |
1257 call prop_add(3, 5, #{type: 'under', length: 4}) | 1256 call prop_add(3, 5, #{type: 'under', length: 4}) |
1258 call prop_add(3, 13, #{type: 'over', length: 4}) | 1257 call prop_add(3, 13, #{type: 'over', length: 4}) |
1259 set cursorline | 1258 set cursorline |
1260 2 | 1259 2 |
1261 END | 1260 END |
1262 call writefile(lines, 'XtestOverProp') | 1261 call writefile(lines, 'XtestOverProp', 'D') |
1263 let buf = RunVimInTerminal('-S XtestOverProp', {'rows': 8}) | 1262 let buf = RunVimInTerminal('-S XtestOverProp', {'rows': 8}) |
1264 call VerifyScreenDump(buf, 'Test_textprop_hl_override_1', {}) | 1263 call VerifyScreenDump(buf, 'Test_textprop_hl_override_1', {}) |
1265 | 1264 |
1266 call term_sendkeys(buf, "3Gllv$hh") | 1265 call term_sendkeys(buf, "3Gllv$hh") |
1267 call VerifyScreenDump(buf, 'Test_textprop_hl_override_2', {}) | 1266 call VerifyScreenDump(buf, 'Test_textprop_hl_override_2', {}) |
1268 call term_sendkeys(buf, "\<Esc>") | 1267 call term_sendkeys(buf, "\<Esc>") |
1269 | 1268 |
1270 " clean up | 1269 " clean up |
1271 call StopVimInTerminal(buf) | 1270 call StopVimInTerminal(buf) |
1272 call delete('XtestOverProp') | |
1273 endfunc | 1271 endfunc |
1274 | 1272 |
1275 func RunTestVisualBlock(width, dump) | 1273 func RunTestVisualBlock(width, dump) |
1276 call writefile([ | 1274 call writefile([ |
1277 \ "call setline(1, [" | 1275 \ "call setline(1, [" |
1297 \ "call prop_add(7, 5, {'length': 3, 'type': 'search'})", | 1295 \ "call prop_add(7, 5, {'length': 3, 'type': 'search'})", |
1298 \ "call prop_add(8, 4, {'length': 3, 'type': 'search'})", | 1296 \ "call prop_add(8, 4, {'length': 3, 'type': 'search'})", |
1299 \ "call prop_add(9, 3, {'length': 3, 'type': 'search'})", | 1297 \ "call prop_add(9, 3, {'length': 3, 'type': 'search'})", |
1300 \ "call prop_add(10, 2, {'length': 3, 'type': 'search'})", | 1298 \ "call prop_add(10, 2, {'length': 3, 'type': 'search'})", |
1301 \ "normal 1G6|\<C-V>" .. repeat('l', a:width - 1) .. "10jx", | 1299 \ "normal 1G6|\<C-V>" .. repeat('l', a:width - 1) .. "10jx", |
1302 \], 'XtestPropVis') | 1300 \], 'XtestPropVis', 'D') |
1303 let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12}) | 1301 let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12}) |
1304 call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {}) | 1302 call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {}) |
1305 | 1303 |
1306 " clean up | 1304 " clean up |
1307 call StopVimInTerminal(buf) | 1305 call StopVimInTerminal(buf) |
1308 call delete('XtestPropVis') | |
1309 endfunc | 1306 endfunc |
1310 | 1307 |
1311 " screenshot test with Visual block mode operations | 1308 " screenshot test with Visual block mode operations |
1312 func Test_textprop_screenshot_visual() | 1309 func Test_textprop_screenshot_visual() |
1313 CheckScreendump | 1310 CheckScreendump |
1330 hi SearchProp ctermbg=yellow | 1327 hi SearchProp ctermbg=yellow |
1331 call prop_type_add('search', {'highlight': 'SearchProp'}) | 1328 call prop_type_add('search', {'highlight': 'SearchProp'}) |
1332 call prop_add(1, 2, {'length': 3, 'type': 'search'}) | 1329 call prop_add(1, 2, {'length': 3, 'type': 'search'}) |
1333 call prop_add(2, 3, {'length': 3, 'type': 'search'}) | 1330 call prop_add(2, 3, {'length': 3, 'type': 'search'}) |
1334 END | 1331 END |
1335 call writefile(lines, 'XtestPropTab') | 1332 call writefile(lines, 'XtestPropTab', 'D') |
1336 let buf = RunVimInTerminal('-S XtestPropTab', {'rows': 6}) | 1333 let buf = RunVimInTerminal('-S XtestPropTab', {'rows': 6}) |
1337 call VerifyScreenDump(buf, 'Test_textprop_tab', {}) | 1334 call VerifyScreenDump(buf, 'Test_textprop_tab', {}) |
1338 | 1335 |
1339 " clean up | 1336 " clean up |
1340 call StopVimInTerminal(buf) | 1337 call StopVimInTerminal(buf) |
1341 call delete('XtestPropTab') | |
1342 endfunc | 1338 endfunc |
1343 | 1339 |
1344 func Test_textprop_nowrap_scrolled() | 1340 func Test_textprop_nowrap_scrolled() |
1345 CheckScreendump | 1341 CheckScreendump |
1346 | 1342 |
1351 prop_type_add('number', {'highlight': 'ErrorMsg'}) | 1347 prop_type_add('number', {'highlight': 'ErrorMsg'}) |
1352 prop_add(1, 12, {'length': 3, 'type': 'number'}) | 1348 prop_add(1, 12, {'length': 3, 'type': 'number'}) |
1353 prop_add(1, 32, {'length': 4, 'type': 'number'}) | 1349 prop_add(1, 32, {'length': 4, 'type': 'number'}) |
1354 feedkeys('gg20zl', 'nxt') | 1350 feedkeys('gg20zl', 'nxt') |
1355 END | 1351 END |
1356 call writefile(lines, 'XtestNowrap') | 1352 call writefile(lines, 'XtestNowrap', 'D') |
1357 let buf = RunVimInTerminal('-S XtestNowrap', {'rows': 6}) | 1353 let buf = RunVimInTerminal('-S XtestNowrap', {'rows': 6}) |
1358 call VerifyScreenDump(buf, 'Test_textprop_nowrap_01', {}) | 1354 call VerifyScreenDump(buf, 'Test_textprop_nowrap_01', {}) |
1359 | 1355 |
1360 call term_sendkeys(buf, "$") | 1356 call term_sendkeys(buf, "$") |
1361 call VerifyScreenDump(buf, 'Test_textprop_nowrap_02', {}) | 1357 call VerifyScreenDump(buf, 'Test_textprop_nowrap_02', {}) |
1362 | 1358 |
1363 " clean up | 1359 " clean up |
1364 call StopVimInTerminal(buf) | 1360 call StopVimInTerminal(buf) |
1365 call delete('XtestNowrap') | |
1366 endfunc | 1361 endfunc |
1367 | 1362 |
1368 func Test_textprop_text_priority() | 1363 func Test_textprop_text_priority() |
1369 CheckScreendump | 1364 CheckScreendump |
1370 | 1365 |
1381 call prop_add(1, 11, #{type: 'one', text: 'one: '}) | 1376 call prop_add(1, 11, #{type: 'one', text: 'one: '}) |
1382 call prop_add(1, 11, #{type: 'arg', length: len('call')}) | 1377 call prop_add(1, 11, #{type: 'arg', length: len('call')}) |
1383 call prop_add(1, 17, #{type: 'two', text: 'two: '}) | 1378 call prop_add(1, 17, #{type: 'two', text: 'two: '}) |
1384 call prop_add(1, 17, #{type: 'arg', length: len('argument')}) | 1379 call prop_add(1, 17, #{type: 'arg', length: len('argument')}) |
1385 END | 1380 END |
1386 call writefile(lines, 'XtestPropPrio') | 1381 call writefile(lines, 'XtestPropPrio', 'D') |
1387 let buf = RunVimInTerminal('-S XtestPropPrio', {'rows': 5}) | 1382 let buf = RunVimInTerminal('-S XtestPropPrio', {'rows': 5}) |
1388 call VerifyScreenDump(buf, 'Test_prop_at_same_pos', {}) | 1383 call VerifyScreenDump(buf, 'Test_prop_at_same_pos', {}) |
1389 | 1384 |
1390 " clean up | 1385 " clean up |
1391 call StopVimInTerminal(buf) | 1386 call StopVimInTerminal(buf) |
1392 call delete('XtestPropPrio') | |
1393 endfunc | 1387 endfunc |
1394 | 1388 |
1395 func Test_textprop_with_syntax() | 1389 func Test_textprop_with_syntax() |
1396 CheckScreendump | 1390 CheckScreendump |
1397 | 1391 |
1403 hi! link csParens MatchParen | 1397 hi! link csParens MatchParen |
1404 | 1398 |
1405 call prop_type_add('TPTitle', #{ highlight: 'Title' }) | 1399 call prop_type_add('TPTitle', #{ highlight: 'Title' }) |
1406 call prop_add(1, 2, #{type: 'TPTitle', end_col: 5}) | 1400 call prop_add(1, 2, #{type: 'TPTitle', end_col: 5}) |
1407 END | 1401 END |
1408 call writefile(lines, 'XtestPropSyn') | 1402 call writefile(lines, 'XtestPropSyn', 'D') |
1409 let buf = RunVimInTerminal('-S XtestPropSyn', {'rows': 6}) | 1403 let buf = RunVimInTerminal('-S XtestPropSyn', {'rows': 6}) |
1410 call VerifyScreenDump(buf, 'Test_textprop_syn_1', {}) | 1404 call VerifyScreenDump(buf, 'Test_textprop_syn_1', {}) |
1411 | 1405 |
1412 " clean up | 1406 " clean up |
1413 call StopVimInTerminal(buf) | 1407 call StopVimInTerminal(buf) |
1414 call delete('XtestPropSyn') | |
1415 endfunc | 1408 endfunc |
1416 | 1409 |
1417 " Adding a text property to a new buffer should not fail | 1410 " Adding a text property to a new buffer should not fail |
1418 func Test_textprop_empty_buffer() | 1411 func Test_textprop_empty_buffer() |
1419 call prop_type_add('comment', {'highlight': 'Search'}) | 1412 call prop_type_add('comment', {'highlight': 'Search'}) |
1932 syntax match xTest /.*/ | 1925 syntax match xTest /.*/ |
1933 hi link xTest Comment | 1926 hi link xTest Comment |
1934 set signcolumn=yes | 1927 set signcolumn=yes |
1935 endfunc | 1928 endfunc |
1936 END | 1929 END |
1937 call writefile(lines, 'XscriptPropLinebreak') | 1930 call writefile(lines, 'XscriptPropLinebreak', 'D') |
1938 let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10}) | 1931 let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10}) |
1939 call VerifyScreenDump(buf, 'Test_prop_linebreak_1', {}) | 1932 call VerifyScreenDump(buf, 'Test_prop_linebreak_1', {}) |
1940 | 1933 |
1941 call term_sendkeys(buf, ":call AddMatch()\<CR>") | 1934 call term_sendkeys(buf, ":call AddMatch()\<CR>") |
1942 call VerifyScreenDump(buf, 'Test_prop_linebreak_2', {}) | 1935 call VerifyScreenDump(buf, 'Test_prop_linebreak_2', {}) |
1943 | 1936 |
1944 call StopVimInTerminal(buf) | 1937 call StopVimInTerminal(buf) |
1945 call delete('XscriptPropLinebreak') | |
1946 endfunc | 1938 endfunc |
1947 | 1939 |
1948 func Test_prop_with_linebreak() | 1940 func Test_prop_with_linebreak() |
1949 CheckRunVimInTerminal | 1941 CheckRunVimInTerminal |
1950 | 1942 |
1953 set linebreak | 1945 set linebreak |
1954 setline(1, 'one twoword') | 1946 setline(1, 'one twoword') |
1955 prop_type_add('test', {highlight: 'Special'}) | 1947 prop_type_add('test', {highlight: 'Special'}) |
1956 prop_add(1, 4, {text: ': virtual text', type: 'test', text_wrap: 'wrap'}) | 1948 prop_add(1, 4, {text: ': virtual text', type: 'test', text_wrap: 'wrap'}) |
1957 END | 1949 END |
1958 call writefile(lines, 'XscriptPropWithLinebreak') | 1950 call writefile(lines, 'XscriptPropWithLinebreak', 'D') |
1959 let buf = RunVimInTerminal('-S XscriptPropWithLinebreak', #{rows: 6, cols: 50}) | 1951 let buf = RunVimInTerminal('-S XscriptPropWithLinebreak', #{rows: 6, cols: 50}) |
1960 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_1', {}) | 1952 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_1', {}) |
1961 call term_sendkeys(buf, "iasdf asdf asdf asdf asdf as\<Esc>") | 1953 call term_sendkeys(buf, "iasdf asdf asdf asdf asdf as\<Esc>") |
1962 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_2', {}) | 1954 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_2', {}) |
1963 | 1955 |
1964 call StopVimInTerminal(buf) | 1956 call StopVimInTerminal(buf) |
1965 call delete('XscriptPropWithLinebreak') | |
1966 endfunc | 1957 endfunc |
1967 | 1958 |
1968 func Test_prop_with_wrap() | 1959 func Test_prop_with_wrap() |
1969 CheckRunVimInTerminal | 1960 CheckRunVimInTerminal |
1970 | 1961 |
1973 set linebreak | 1964 set linebreak |
1974 setline(1, 'asdf '->repeat(15)) | 1965 setline(1, 'asdf '->repeat(15)) |
1975 prop_type_add('test', {highlight: 'Special'}) | 1966 prop_type_add('test', {highlight: 'Special'}) |
1976 prop_add(1, 43, {text: 'some virtual text', type: 'test'}) | 1967 prop_add(1, 43, {text: 'some virtual text', type: 'test'}) |
1977 END | 1968 END |
1978 call writefile(lines, 'XscriptPropWithWrap') | 1969 call writefile(lines, 'XscriptPropWithWrap', 'D') |
1979 let buf = RunVimInTerminal('-S XscriptPropWithWrap', #{rows: 6, cols: 50}) | 1970 let buf = RunVimInTerminal('-S XscriptPropWithWrap', #{rows: 6, cols: 50}) |
1980 call VerifyScreenDump(buf, 'Test_prop_with_wrap_1', {}) | 1971 call VerifyScreenDump(buf, 'Test_prop_with_wrap_1', {}) |
1981 | 1972 |
1982 call StopVimInTerminal(buf) | 1973 call StopVimInTerminal(buf) |
1983 call delete('XscriptPropWithWrap') | |
1984 endfunc | 1974 endfunc |
1985 | 1975 |
1986 func Test_prop_after_tab() | 1976 func Test_prop_after_tab() |
1987 CheckRunVimInTerminal | 1977 CheckRunVimInTerminal |
1988 | 1978 |
1990 set breakindent linebreak breakat+=] | 1980 set breakindent linebreak breakat+=] |
1991 call setline(1, "\t[xxx]") | 1981 call setline(1, "\t[xxx]") |
1992 call prop_type_add('test', #{highlight: 'ErrorMsg'}) | 1982 call prop_type_add('test', #{highlight: 'ErrorMsg'}) |
1993 call prop_add(1, 2, #{length: 1, type: 'test'}) | 1983 call prop_add(1, 2, #{length: 1, type: 'test'}) |
1994 END | 1984 END |
1995 call writefile(lines, 'XscriptPropAfterTab') | 1985 call writefile(lines, 'XscriptPropAfterTab', 'D') |
1996 let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10}) | 1986 let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10}) |
1997 call VerifyScreenDump(buf, 'Test_prop_after_tab', {}) | 1987 call VerifyScreenDump(buf, 'Test_prop_after_tab', {}) |
1998 | 1988 |
1999 call StopVimInTerminal(buf) | 1989 call StopVimInTerminal(buf) |
2000 call delete('XscriptPropAfterTab') | |
2001 endfunc | 1990 endfunc |
2002 | 1991 |
2003 func Test_prop_before_tab() | 1992 func Test_prop_before_tab() |
2004 CheckRunVimInTerminal | 1993 CheckRunVimInTerminal |
2005 | 1994 |
2012 call prop_add(4, 1, #{type: 'test', text: '123456789'}) | 2001 call prop_add(4, 1, #{type: 'test', text: '123456789'}) |
2013 call prop_add(5, 2, #{type: 'test', text: 'ABC'}) | 2002 call prop_add(5, 2, #{type: 'test', text: 'ABC'}) |
2014 call prop_add(6, 3, #{type: 'test', text: 'ABC'}) | 2003 call prop_add(6, 3, #{type: 'test', text: 'ABC'}) |
2015 normal gg0 | 2004 normal gg0 |
2016 END | 2005 END |
2017 call writefile(lines, 'XscriptPropBeforeTab') | 2006 call writefile(lines, 'XscriptPropBeforeTab', 'D') |
2018 let buf = RunVimInTerminal('-S XscriptPropBeforeTab', #{rows: 8}) | 2007 let buf = RunVimInTerminal('-S XscriptPropBeforeTab', #{rows: 8}) |
2019 call VerifyScreenDump(buf, 'Test_prop_before_tab_01', {}) | 2008 call VerifyScreenDump(buf, 'Test_prop_before_tab_01', {}) |
2020 call term_sendkeys(buf, "$") | 2009 call term_sendkeys(buf, "$") |
2021 call VerifyScreenDump(buf, 'Test_prop_before_tab_02', {}) | 2010 call VerifyScreenDump(buf, 'Test_prop_before_tab_02', {}) |
2022 call term_sendkeys(buf, "j0") | 2011 call term_sendkeys(buf, "j0") |
2035 call VerifyScreenDump(buf, 'Test_prop_before_tab_09', {}) | 2024 call VerifyScreenDump(buf, 'Test_prop_before_tab_09', {}) |
2036 call term_sendkeys(buf, "j") | 2025 call term_sendkeys(buf, "j") |
2037 call VerifyScreenDump(buf, 'Test_prop_before_tab_10', {}) | 2026 call VerifyScreenDump(buf, 'Test_prop_before_tab_10', {}) |
2038 | 2027 |
2039 call StopVimInTerminal(buf) | 2028 call StopVimInTerminal(buf) |
2040 call delete('XscriptPropBeforeTab') | |
2041 endfunc | 2029 endfunc |
2042 | 2030 |
2043 func Test_prop_after_linebreak() | 2031 func Test_prop_after_linebreak() |
2044 CheckRunVimInTerminal | 2032 CheckRunVimInTerminal |
2045 | 2033 |
2047 set linebreak wrap | 2035 set linebreak wrap |
2048 call printf('%s+(%s)', 'x'->repeat(&columns / 2), 'x'->repeat(&columns / 2))->setline(1) | 2036 call printf('%s+(%s)', 'x'->repeat(&columns / 2), 'x'->repeat(&columns / 2))->setline(1) |
2049 call prop_type_add('test', #{highlight: 'ErrorMsg'}) | 2037 call prop_type_add('test', #{highlight: 'ErrorMsg'}) |
2050 call prop_add(1, (&columns / 2) + 2, #{length: 1, type: 'test'}) | 2038 call prop_add(1, (&columns / 2) + 2, #{length: 1, type: 'test'}) |
2051 END | 2039 END |
2052 call writefile(lines, 'XscriptPropAfterLinebreak') | 2040 call writefile(lines, 'XscriptPropAfterLinebreak', 'D') |
2053 let buf = RunVimInTerminal('-S XscriptPropAfterLinebreak', #{rows: 10}) | 2041 let buf = RunVimInTerminal('-S XscriptPropAfterLinebreak', #{rows: 10}) |
2054 call VerifyScreenDump(buf, 'Test_prop_after_linebreak', {}) | 2042 call VerifyScreenDump(buf, 'Test_prop_after_linebreak', {}) |
2055 | 2043 |
2056 call StopVimInTerminal(buf) | 2044 call StopVimInTerminal(buf) |
2057 call delete('XscriptPropAfterLinebreak') | |
2058 endfunc | 2045 endfunc |
2059 | 2046 |
2060 " Buffer number of 0 should be ignored, as if the parameter wasn't passed. | 2047 " Buffer number of 0 should be ignored, as if the parameter wasn't passed. |
2061 def Test_prop_bufnr_zero() | 2048 def Test_prop_bufnr_zero() |
2062 new | 2049 new |
2518 | 2505 |
2519 call setline(5, 'look highlight') | 2506 call setline(5, 'look highlight') |
2520 call prop_type_add('nohi', #{}) | 2507 call prop_type_add('nohi', #{}) |
2521 call prop_add(5, 6, #{type: 'nohi', text: 'no '}) | 2508 call prop_add(5, 6, #{type: 'nohi', text: 'no '}) |
2522 END | 2509 END |
2523 call writefile(lines, 'XscriptPropsWithText') | 2510 call writefile(lines, 'XscriptPropsWithText', 'D') |
2524 let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 8, cols: 60}) | 2511 let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 8, cols: 60}) |
2525 call VerifyScreenDump(buf, 'Test_prop_inserts_text_1', {}) | 2512 call VerifyScreenDump(buf, 'Test_prop_inserts_text_1', {}) |
2526 | 2513 |
2527 call term_sendkeys(buf, ":set signcolumn=yes\<CR>") | 2514 call term_sendkeys(buf, ":set signcolumn=yes\<CR>") |
2528 call VerifyScreenDump(buf, 'Test_prop_inserts_text_2', {}) | 2515 call VerifyScreenDump(buf, 'Test_prop_inserts_text_2', {}) |
2537 | 2524 |
2538 call term_sendkeys(buf, "4G") | 2525 call term_sendkeys(buf, "4G") |
2539 call VerifyScreenDump(buf, 'Test_prop_inserts_text_6', {}) | 2526 call VerifyScreenDump(buf, 'Test_prop_inserts_text_6', {}) |
2540 | 2527 |
2541 call StopVimInTerminal(buf) | 2528 call StopVimInTerminal(buf) |
2542 call delete('XscriptPropsWithText') | |
2543 endfunc | 2529 endfunc |
2544 | 2530 |
2545 func Test_prop_inserts_text_highlight() | 2531 func Test_prop_inserts_text_highlight() |
2546 CheckRunVimInTerminal | 2532 CheckRunVimInTerminal |
2547 | 2533 |
2557 call prop_add(1, 19, #{type: 'someprop', text: 'AFTER'}) | 2543 call prop_add(1, 19, #{type: 'someprop', text: 'AFTER'}) |
2558 let g:thematch = matchaddpos("DiffAdd", [[1, 18]]) | 2544 let g:thematch = matchaddpos("DiffAdd", [[1, 18]]) |
2559 let @/ = '' | 2545 let @/ = '' |
2560 endfunc | 2546 endfunc |
2561 END | 2547 END |
2562 call writefile(lines, 'XscriptPropsWithHighlight') | 2548 call writefile(lines, 'XscriptPropsWithHighlight', 'D') |
2563 let buf = RunVimInTerminal('-S XscriptPropsWithHighlight', #{rows: 6, cols: 60}) | 2549 let buf = RunVimInTerminal('-S XscriptPropsWithHighlight', #{rows: 6, cols: 60}) |
2564 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_1', {}) | 2550 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_1', {}) |
2565 call term_sendkeys(buf, "/text (he\<CR>") | 2551 call term_sendkeys(buf, "/text (he\<CR>") |
2566 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_2', {}) | 2552 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_2', {}) |
2567 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>") | 2553 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>") |
2573 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_5', {}) | 2559 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_5', {}) |
2574 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>") | 2560 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>") |
2575 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_6', {}) | 2561 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_6', {}) |
2576 | 2562 |
2577 call StopVimInTerminal(buf) | 2563 call StopVimInTerminal(buf) |
2578 call delete('XscriptPropsWithHighlight') | |
2579 endfunc | 2564 endfunc |
2580 | 2565 |
2581 func Test_prop_add_with_text_fails() | 2566 func Test_prop_add_with_text_fails() |
2582 call prop_type_add('failing', #{highlight: 'ErrorMsg'}) | 2567 call prop_type_add('failing', #{highlight: 'ErrorMsg'}) |
2583 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') | 2568 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') |
2597 call prop_add(1, 0, #{type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'}) | 2582 call prop_add(1, 0, #{type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'}) |
2598 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right'}) | 2583 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right'}) |
2599 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right'}) | 2584 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right'}) |
2600 normal G$ | 2585 normal G$ |
2601 END | 2586 END |
2602 call writefile(lines, 'XscriptPropsRightAlign') | 2587 call writefile(lines, 'XscriptPropsRightAlign', 'D') |
2603 let buf = RunVimInTerminal('-S XscriptPropsRightAlign', #{rows: 8}) | 2588 let buf = RunVimInTerminal('-S XscriptPropsRightAlign', #{rows: 8}) |
2604 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_1', {}) | 2589 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_1', {}) |
2605 | 2590 |
2606 call term_sendkeys(buf, "ggisome more text\<Esc>G$") | 2591 call term_sendkeys(buf, "ggisome more text\<Esc>G$") |
2607 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_2', {}) | 2592 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_2', {}) |
2608 | 2593 |
2609 call term_sendkeys(buf, ":set signcolumn=yes\<CR>") | 2594 call term_sendkeys(buf, ":set signcolumn=yes\<CR>") |
2610 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_3', {}) | 2595 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_3', {}) |
2611 | 2596 |
2612 call StopVimInTerminal(buf) | 2597 call StopVimInTerminal(buf) |
2613 call delete('XscriptPropsRightAlign') | |
2614 endfunc | 2598 endfunc |
2615 | 2599 |
2616 func Test_props_with_text_after() | 2600 func Test_props_with_text_after() |
2617 CheckRunVimInTerminal | 2601 CheckRunVimInTerminal |
2618 | 2602 |
2633 normal G$ | 2617 normal G$ |
2634 | 2618 |
2635 call setline(3, 'right here') | 2619 call setline(3, 'right here') |
2636 call prop_add(3, 0, #{type: 'rightprop', text: 'söme和平téxt', text_align: 'right'}) | 2620 call prop_add(3, 0, #{type: 'rightprop', text: 'söme和平téxt', text_align: 'right'}) |
2637 END | 2621 END |
2638 call writefile(lines, 'XscriptPropsWithTextAfter') | 2622 call writefile(lines, 'XscriptPropsWithTextAfter', 'D') |
2639 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfter', #{rows: 8, cols: 60}) | 2623 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfter', #{rows: 8, cols: 60}) |
2640 call VerifyScreenDump(buf, 'Test_prop_with_text_after_1', {}) | 2624 call VerifyScreenDump(buf, 'Test_prop_with_text_after_1', {}) |
2641 | 2625 |
2642 call StopVimInTerminal(buf) | 2626 call StopVimInTerminal(buf) |
2643 call delete('XscriptPropsWithTextAfter') | |
2644 | 2627 |
2645 call assert_fails('call prop_add(1, 2, #{text: "yes", text_align: "right", type: "some"})', 'E1294:') | 2628 call assert_fails('call prop_add(1, 2, #{text: "yes", text_align: "right", type: "some"})', 'E1294:') |
2646 endfunc | 2629 endfunc |
2647 | 2630 |
2648 func Test_props_with_text_after_below_trunc() | 2631 func Test_props_with_text_after_below_trunc() |
2664 text: 'the quick brown fox jumps over the lazy dog', | 2647 text: 'the quick brown fox jumps over the lazy dog', |
2665 text_align: 'below' | 2648 text_align: 'below' |
2666 }) | 2649 }) |
2667 normal G$ | 2650 normal G$ |
2668 END | 2651 END |
2669 call writefile(lines, 'XscriptPropsAfterTrunc') | 2652 call writefile(lines, 'XscriptPropsAfterTrunc', 'D') |
2670 let buf = RunVimInTerminal('-S XscriptPropsAfterTrunc', #{rows: 8, cols: 60}) | 2653 let buf = RunVimInTerminal('-S XscriptPropsAfterTrunc', #{rows: 8, cols: 60}) |
2671 call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_1', {}) | 2654 call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_1', {}) |
2672 | 2655 |
2673 call StopVimInTerminal(buf) | 2656 call StopVimInTerminal(buf) |
2674 call delete('XscriptPropsAfterTrunc') | |
2675 endfunc | 2657 endfunc |
2676 | 2658 |
2677 func Test_props_with_text_after_joined() | 2659 func Test_props_with_text_after_joined() |
2678 CheckRunVimInTerminal | 2660 CheckRunVimInTerminal |
2679 | 2661 |
2690 call prop_add(5, 0, #{type: 'afterprop', text: ' CCC', text_align: 'after'}) | 2672 call prop_add(5, 0, #{type: 'afterprop', text: ' CCC', text_align: 'after'}) |
2691 call prop_add(7, 0, #{type: 'afterprop', text: ' EEE', text_align: 'after'}) | 2673 call prop_add(7, 0, #{type: 'afterprop', text: ' EEE', text_align: 'after'}) |
2692 call prop_add(8, 0, #{type: 'afterprop', text: ' FFF', text_align: 'after'}) | 2674 call prop_add(8, 0, #{type: 'afterprop', text: ' FFF', text_align: 'after'}) |
2693 normal 3G6J | 2675 normal 3G6J |
2694 END | 2676 END |
2695 call writefile(lines, 'XscriptPropsWithTextAfterJoined') | 2677 call writefile(lines, 'XscriptPropsWithTextAfterJoined', 'D') |
2696 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterJoined', #{rows: 6, cols: 60}) | 2678 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterJoined', #{rows: 6, cols: 60}) |
2697 call VerifyScreenDump(buf, 'Test_prop_with_text_after_joined_1', {}) | 2679 call VerifyScreenDump(buf, 'Test_prop_with_text_after_joined_1', {}) |
2698 | 2680 |
2699 call StopVimInTerminal(buf) | 2681 call StopVimInTerminal(buf) |
2700 call delete('XscriptPropsWithTextAfterJoined') | |
2701 endfunc | 2682 endfunc |
2702 | 2683 |
2703 func Test_props_with_text_after_truncated() | 2684 func Test_props_with_text_after_truncated() |
2704 CheckRunVimInTerminal | 2685 CheckRunVimInTerminal |
2705 | 2686 |
2715 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'}) | 2696 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'}) |
2716 | 2697 |
2717 call setline(4, ['cursor here']) | 2698 call setline(4, ['cursor here']) |
2718 normal 4Gfh | 2699 normal 4Gfh |
2719 END | 2700 END |
2720 call writefile(lines, 'XscriptPropsWithTextAfterTrunc') | 2701 call writefile(lines, 'XscriptPropsWithTextAfterTrunc', 'D') |
2721 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc', #{rows: 9, cols: 60}) | 2702 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc', #{rows: 9, cols: 60}) |
2722 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_1', {}) | 2703 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_1', {}) |
2723 | 2704 |
2724 call term_sendkeys(buf, ":37vsp\<CR>gg") | 2705 call term_sendkeys(buf, ":37vsp\<CR>gg") |
2725 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_2', {}) | 2706 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_2', {}) |
2734 call term_sendkeys(buf, ":18wincmd |\<CR>") | 2715 call term_sendkeys(buf, ":18wincmd |\<CR>") |
2735 call term_sendkeys(buf, "0fx") | 2716 call term_sendkeys(buf, "0fx") |
2736 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_5', {}) | 2717 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_5', {}) |
2737 | 2718 |
2738 call StopVimInTerminal(buf) | 2719 call StopVimInTerminal(buf) |
2739 call delete('XscriptPropsWithTextAfterTrunc') | |
2740 endfunc | 2720 endfunc |
2741 | 2721 |
2742 func Test_props_with_text_empty_line() | 2722 func Test_props_with_text_empty_line() |
2743 CheckRunVimInTerminal | 2723 CheckRunVimInTerminal |
2744 | 2724 |
2747 call prop_type_add('prop1', #{highlight: 'Search'}) | 2727 call prop_type_add('prop1', #{highlight: 'Search'}) |
2748 call prop_add(1, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns)}) | 2728 call prop_add(1, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns)}) |
2749 call prop_add(3, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns + 1)}) | 2729 call prop_add(3, 1, #{type: 'prop1', text_wrap: 'wrap', text: repeat('X', &columns + 1)}) |
2750 normal gg0 | 2730 normal gg0 |
2751 END | 2731 END |
2752 call writefile(lines, 'XscriptPropsWithTextEmptyLine') | 2732 call writefile(lines, 'XscriptPropsWithTextEmptyLine', 'D') |
2753 let buf = RunVimInTerminal('-S XscriptPropsWithTextEmptyLine', #{rows: 8, cols: 60}) | 2733 let buf = RunVimInTerminal('-S XscriptPropsWithTextEmptyLine', #{rows: 8, cols: 60}) |
2754 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_1', {}) | 2734 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_1', {}) |
2755 call term_sendkeys(buf, "$") | 2735 call term_sendkeys(buf, "$") |
2756 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_2', {}) | 2736 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_2', {}) |
2757 call term_sendkeys(buf, "j") | 2737 call term_sendkeys(buf, "j") |
2760 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_4', {}) | 2740 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_4', {}) |
2761 call term_sendkeys(buf, "j") | 2741 call term_sendkeys(buf, "j") |
2762 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_5', {}) | 2742 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_5', {}) |
2763 | 2743 |
2764 call StopVimInTerminal(buf) | 2744 call StopVimInTerminal(buf) |
2765 call delete('XscriptPropsWithTextEmptyLine') | |
2766 endfunc | 2745 endfunc |
2767 | 2746 |
2768 func Test_props_with_text_after_wraps() | 2747 func Test_props_with_text_after_wraps() |
2769 CheckRunVimInTerminal | 2748 CheckRunVimInTerminal |
2770 | 2749 |
2780 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below', text_wrap: 'wrap'}) | 2759 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below', text_wrap: 'wrap'}) |
2781 | 2760 |
2782 call setline(4, ['cursor here']) | 2761 call setline(4, ['cursor here']) |
2783 normal 4Gfh | 2762 normal 4Gfh |
2784 END | 2763 END |
2785 call writefile(lines, 'XscriptPropsWithTextAfterWraps') | 2764 call writefile(lines, 'XscriptPropsWithTextAfterWraps', 'D') |
2786 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterWraps', #{rows: 9, cols: 60}) | 2765 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterWraps', #{rows: 9, cols: 60}) |
2787 call VerifyScreenDump(buf, 'Test_prop_with_text_after_wraps_1', {}) | 2766 call VerifyScreenDump(buf, 'Test_prop_with_text_after_wraps_1', {}) |
2788 | 2767 |
2789 call StopVimInTerminal(buf) | 2768 call StopVimInTerminal(buf) |
2790 call delete('XscriptPropsWithTextAfterWraps') | |
2791 endfunc | 2769 endfunc |
2792 | 2770 |
2793 func Test_props_with_text_after_nowrap() | 2771 func Test_props_with_text_after_nowrap() |
2794 CheckRunVimInTerminal | 2772 CheckRunVimInTerminal |
2795 | 2773 |
2808 | 2786 |
2809 call prop_add(3, 0, #{type: 'anotherprop', text: 'right aligned', text_align: 'right'}) | 2787 call prop_add(3, 0, #{type: 'anotherprop', text: 'right aligned', text_align: 'right'}) |
2810 call prop_add(3, 0, #{type: 'anotherprop', text: 'also right aligned', text_align: 'right'}) | 2788 call prop_add(3, 0, #{type: 'anotherprop', text: 'also right aligned', text_align: 'right'}) |
2811 hi CursorLine ctermbg=lightgrey | 2789 hi CursorLine ctermbg=lightgrey |
2812 END | 2790 END |
2813 call writefile(lines, 'XscriptPropsAfterNowrap') | 2791 call writefile(lines, 'XscriptPropsAfterNowrap', 'D') |
2814 let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 12, cols: 60}) | 2792 let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 12, cols: 60}) |
2815 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {}) | 2793 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {}) |
2816 | 2794 |
2817 call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3 cursorline\<CR>") | 2795 call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3 cursorline\<CR>") |
2818 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {}) | 2796 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {}) |
2819 | 2797 |
2820 call term_sendkeys(buf, "j") | 2798 call term_sendkeys(buf, "j") |
2821 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_3', {}) | 2799 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_3', {}) |
2822 | 2800 |
2823 call StopVimInTerminal(buf) | 2801 call StopVimInTerminal(buf) |
2824 call delete('XscriptPropsAfterNowrap') | |
2825 endfunc | 2802 endfunc |
2826 | 2803 |
2827 func Test_props_with_text_below_nowrap() | 2804 func Test_props_with_text_below_nowrap() |
2828 CheckRunVimInTerminal | 2805 CheckRunVimInTerminal |
2829 | 2806 |
2844 text: 'the quick brown fox jumps over the lazy dog', | 2821 text: 'the quick brown fox jumps over the lazy dog', |
2845 text_align: 'below' | 2822 text_align: 'below' |
2846 }) | 2823 }) |
2847 normal G$ | 2824 normal G$ |
2848 END | 2825 END |
2849 call writefile(lines, 'XscriptPropsBelowNowrap') | 2826 call writefile(lines, 'XscriptPropsBelowNowrap', 'D') |
2850 let buf = RunVimInTerminal('-S XscriptPropsBelowNowrap', #{rows: 8, cols: 60}) | 2827 let buf = RunVimInTerminal('-S XscriptPropsBelowNowrap', #{rows: 8, cols: 60}) |
2851 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_1', {}) | 2828 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_1', {}) |
2852 | 2829 |
2853 call term_sendkeys(buf, "gg$") | 2830 call term_sendkeys(buf, "gg$") |
2854 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_2', {}) | 2831 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_2', {}) |
2855 | 2832 |
2856 call StopVimInTerminal(buf) | 2833 call StopVimInTerminal(buf) |
2857 call delete('XscriptPropsBelowNowrap') | |
2858 endfunc | 2834 endfunc |
2859 | 2835 |
2860 func Test_props_with_text_above() | 2836 func Test_props_with_text_above() |
2861 CheckRunVimInTerminal | 2837 CheckRunVimInTerminal |
2862 | 2838 |
2931 CheckRunVimInTerminal | 2907 CheckRunVimInTerminal |
2932 | 2908 |
2933 let lines =<< trim END | 2909 let lines =<< trim END |
2934 vim9script | 2910 vim9script |
2935 setline(1, ['one one one', 'two two two', 'three three three']) | 2911 setline(1, ['one one one', 'two two two', 'three three three']) |
2936 prop_type_add('test', {highlight: 'ModeMsg'}) | 2912 prop_type_add('test', {highlight: 'Search'}) |
2937 prop_add(2, 0, { | 2913 prop_add(2, 0, { |
2938 text: '└─ Virtual text below the 2nd line', | 2914 text: '└─ Virtual text below the 2nd line', |
2939 type: 'test', | 2915 type: 'test', |
2940 text_align: 'below', | 2916 text_align: 'below', |
2941 text_padding_left: 3 | 2917 text_padding_left: 3 |
2944 call writefile(lines, 'XscriptPropBelowSpitLine', 'D') | 2920 call writefile(lines, 'XscriptPropBelowSpitLine', 'D') |
2945 let buf = RunVimInTerminal('-S XscriptPropBelowSpitLine', #{rows: 8}) | 2921 let buf = RunVimInTerminal('-S XscriptPropBelowSpitLine', #{rows: 8}) |
2946 call term_sendkeys(buf, "2GA\<CR>xx") | 2922 call term_sendkeys(buf, "2GA\<CR>xx") |
2947 call VerifyScreenDump(buf, 'Test_prop_below_split_line_1', {}) | 2923 call VerifyScreenDump(buf, 'Test_prop_below_split_line_1', {}) |
2948 | 2924 |
2949 call term_sendkeys(buf, "\<Esc>") | 2925 call term_sendkeys(buf, "\<Esc>:set number\<CR>") |
2926 call VerifyScreenDump(buf, 'Test_prop_below_split_line_2', {}) | |
2927 | |
2950 call StopVimInTerminal(buf) | 2928 call StopVimInTerminal(buf) |
2951 endfunc | 2929 endfunc |
2952 | 2930 |
2953 func Test_props_with_text_override() | 2931 func Test_props_with_text_override() |
2954 CheckRunVimInTerminal | 2932 CheckRunVimInTerminal |
2994 endif | 2972 endif |
2995 endfunc | 2973 endfunc |
2996 | 2974 |
2997 autocmd CursorMoved * call Update() | 2975 autocmd CursorMoved * call Update() |
2998 END | 2976 END |
2999 call writefile(lines, 'XscriptPropsCursorMovec') | 2977 call writefile(lines, 'XscriptPropsCursorMovec', 'D') |
3000 let buf = RunVimInTerminal('-S XscriptPropsCursorMovec', #{rows: 8, cols: 60}) | 2978 let buf = RunVimInTerminal('-S XscriptPropsCursorMovec', #{rows: 8, cols: 60}) |
3001 call term_sendkeys(buf, "gg0w") | 2979 call term_sendkeys(buf, "gg0w") |
3002 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {}) | 2980 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {}) |
3003 | 2981 |
3004 call term_sendkeys(buf, "j") | 2982 call term_sendkeys(buf, "j") |
3007 " back to the first state | 2985 " back to the first state |
3008 call term_sendkeys(buf, "k") | 2986 call term_sendkeys(buf, "k") |
3009 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {}) | 2987 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {}) |
3010 | 2988 |
3011 call StopVimInTerminal(buf) | 2989 call StopVimInTerminal(buf) |
3012 call delete('XscriptPropsCursorMovec') | |
3013 endfunc | 2990 endfunc |
3014 | 2991 |
3015 func Test_props_with_text_after_split_join() | 2992 func Test_props_with_text_after_split_join() |
3016 CheckRunVimInTerminal | 2993 CheckRunVimInTerminal |
3017 | 2994 |
3025 call prop_type_add('another', #{highlight: 'Search'}) | 3002 call prop_type_add('another', #{highlight: 'Search'}) |
3026 call prop_add(1, 0, #{type: 'another', text: ' after the text ', text_align: 'after'}) | 3003 call prop_add(1, 0, #{type: 'another', text: ' after the text ', text_align: 'after'}) |
3027 call prop_add(1, 0, #{type: 'another', text: ' right here', text_align: 'right'}) | 3004 call prop_add(1, 0, #{type: 'another', text: ' right here', text_align: 'right'}) |
3028 endfunc | 3005 endfunc |
3029 END | 3006 END |
3030 call writefile(lines, 'XscriptPropsAfterSplitJoin') | 3007 call writefile(lines, 'XscriptPropsAfterSplitJoin', 'D') |
3031 let buf = RunVimInTerminal('-S XscriptPropsAfterSplitJoin', #{rows: 8, cols: 60}) | 3008 let buf = RunVimInTerminal('-S XscriptPropsAfterSplitJoin', #{rows: 8, cols: 60}) |
3032 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_1', {}) | 3009 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_1', {}) |
3033 | 3010 |
3034 call term_sendkeys(buf, "ggJ") | 3011 call term_sendkeys(buf, "ggJ") |
3035 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_2', {}) | 3012 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_2', {}) |
3042 | 3019 |
3043 call term_sendkeys(buf, "ggJ") | 3020 call term_sendkeys(buf, "ggJ") |
3044 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_5', {}) | 3021 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_5', {}) |
3045 | 3022 |
3046 call StopVimInTerminal(buf) | 3023 call StopVimInTerminal(buf) |
3047 call delete('XscriptPropsAfterSplitJoin') | |
3048 endfunc | 3024 endfunc |
3049 | 3025 |
3050 func Test_removed_prop_with_text_cleans_up_array() | 3026 func Test_removed_prop_with_text_cleans_up_array() |
3051 new | 3027 new |
3052 call setline(1, 'some text here') | 3028 call setline(1, 'some text here') |
3097 | 3073 |
3098 set cindent sw=4 | 3074 set cindent sw=4 |
3099 prop_type_add('argname', {highlight: 'DiffChange', start_incl: true}) | 3075 prop_type_add('argname', {highlight: 'DiffChange', start_incl: true}) |
3100 prop_add(3, 10, {type: 'argname', text: 'arg: '}) | 3076 prop_add(3, 10, {type: 'argname', text: 'arg: '}) |
3101 END | 3077 END |
3102 call writefile(lines, 'XscriptPropsStartIncl') | 3078 call writefile(lines, 'XscriptPropsStartIncl', 'D') |
3103 let buf = RunVimInTerminal('-S XscriptPropsStartIncl', #{rows: 8, cols: 60}) | 3079 let buf = RunVimInTerminal('-S XscriptPropsStartIncl', #{rows: 8, cols: 60}) |
3104 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_1', {}) | 3080 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_1', {}) |
3105 | 3081 |
3106 call term_sendkeys(buf, "i") | 3082 call term_sendkeys(buf, "i") |
3107 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_2', {}) | 3083 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_2', {}) |
3119 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_7', {}) | 3095 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_7', {}) |
3120 call term_sendkeys(buf, "<<<<") | 3096 call term_sendkeys(buf, "<<<<") |
3121 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_8', {}) | 3097 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_8', {}) |
3122 | 3098 |
3123 call StopVimInTerminal(buf) | 3099 call StopVimInTerminal(buf) |
3124 call delete('XscriptPropsStartIncl') | |
3125 endfunc | 3100 endfunc |
3126 | 3101 |
3127 func Test_insert_text_list_mode() | 3102 func Test_insert_text_list_mode() |
3128 CheckRunVimInTerminal | 3103 CheckRunVimInTerminal |
3129 | 3104 |
3137 type: 'Prop1', | 3112 type: 'Prop1', |
3138 text: 'The quick brown fox jumps over the lazy dog', | 3113 text: 'The quick brown fox jumps over the lazy dog', |
3139 text_align: 'right' | 3114 text_align: 'right' |
3140 }) | 3115 }) |
3141 END | 3116 END |
3142 call writefile(lines, 'XscriptPropsListMode') | 3117 call writefile(lines, 'XscriptPropsListMode', 'D') |
3143 let buf = RunVimInTerminal('-S XscriptPropsListMode', #{rows: 8, cols: 60}) | 3118 let buf = RunVimInTerminal('-S XscriptPropsListMode', #{rows: 8, cols: 60}) |
3144 call term_sendkeys(buf, "ggj") | 3119 call term_sendkeys(buf, "ggj") |
3145 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_1', {}) | 3120 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_1', {}) |
3146 | 3121 |
3147 call term_sendkeys(buf, ":set nowrap\<CR>") | 3122 call term_sendkeys(buf, ":set nowrap\<CR>") |
3149 | 3124 |
3150 call term_sendkeys(buf, "ggd32l") | 3125 call term_sendkeys(buf, "ggd32l") |
3151 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_3', {}) | 3126 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_3', {}) |
3152 | 3127 |
3153 call StopVimInTerminal(buf) | 3128 call StopVimInTerminal(buf) |
3154 call delete('XscriptPropsListMode') | |
3155 endfunc | 3129 endfunc |
3156 | 3130 |
3157 func Test_insert_text_with_padding() | 3131 func Test_insert_text_with_padding() |
3158 CheckRunVimInTerminal | 3132 CheckRunVimInTerminal |
3159 | 3133 |
3187 text_align: 'right', | 3161 text_align: 'right', |
3188 text_padding_left: 6, | 3162 text_padding_left: 6, |
3189 text_wrap: 'wrap', | 3163 text_wrap: 'wrap', |
3190 }) | 3164 }) |
3191 END | 3165 END |
3192 call writefile(lines, 'XscriptPropsPadded') | 3166 call writefile(lines, 'XscriptPropsPadded', 'D') |
3193 let buf = RunVimInTerminal('-S XscriptPropsPadded', #{rows: 8, cols: 60}) | 3167 let buf = RunVimInTerminal('-S XscriptPropsPadded', #{rows: 8, cols: 60}) |
3194 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_1', {}) | 3168 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_1', {}) |
3195 | 3169 |
3196 call term_sendkeys(buf, "ggixxxxxxxxxx\<Esc>") | 3170 call term_sendkeys(buf, "ggixxxxxxxxxx\<Esc>") |
3197 call term_sendkeys(buf, "3Gix\<Esc>") | 3171 call term_sendkeys(buf, "3Gix\<Esc>") |
3202 | 3176 |
3203 call term_sendkeys(buf, ":set list\<CR>") | 3177 call term_sendkeys(buf, ":set list\<CR>") |
3204 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_4', {}) | 3178 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_4', {}) |
3205 | 3179 |
3206 call StopVimInTerminal(buf) | 3180 call StopVimInTerminal(buf) |
3207 call delete('XscriptPropsPadded') | |
3208 endfunc | 3181 endfunc |
3209 | 3182 |
3210 func Test_insert_text_change_arg() | 3183 func Test_insert_text_change_arg() |
3211 CheckRunVimInTerminal | 3184 CheckRunVimInTerminal |
3212 | 3185 |
3230 prop_add(1, 19, { | 3203 prop_add(1, 19, { |
3231 type: 'padd', | 3204 type: 'padd', |
3232 text: '-', | 3205 text: '-', |
3233 }) | 3206 }) |
3234 END | 3207 END |
3235 call writefile(lines, 'XscriptPropsChange') | 3208 call writefile(lines, 'XscriptPropsChange', 'D') |
3236 let buf = RunVimInTerminal('-S XscriptPropsChange', #{rows: 5, cols: 60}) | 3209 let buf = RunVimInTerminal('-S XscriptPropsChange', #{rows: 5, cols: 60}) |
3237 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_1', {}) | 3210 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_1', {}) |
3238 | 3211 |
3239 call term_sendkeys(buf, "ggf1cw1234\<Esc>") | 3212 call term_sendkeys(buf, "ggf1cw1234\<Esc>") |
3240 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_2', {}) | 3213 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_2', {}) |
3241 | 3214 |
3242 call StopVimInTerminal(buf) | 3215 call StopVimInTerminal(buf) |
3243 call delete('XscriptPropsChange') | |
3244 endfunc | 3216 endfunc |
3245 | 3217 |
3246 " vim: shiftwidth=2 sts=2 expandtab | 3218 " vim: shiftwidth=2 sts=2 expandtab |