Mercurial > vim
comparison src/testdir/test_textprop.vim @ 29597:f2d7f20d83c3 v9.0.0139
patch 9.0.0139: truncating virtual text after a line not implemented
Commit: https://github.com/vim/vim/commit/398649ee44edeb309c77361de697320378104b70
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 4 15:03:48 2022 +0100
patch 9.0.0139: truncating virtual text after a line not implemented
Problem: Truncating virtual text after a line not implemented.
Cursor positioning wrong with Newline in the text.
Solution: Implement truncating. Disallow control characters in the text.
(closes #10842)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Aug 2022 16:15:08 +0200 |
parents | d70f588baaa1 |
children | 0340a59e04ca |
comparison
equal
deleted
inserted
replaced
29596:aea558552904 | 29597:f2d7f20d83c3 |
---|---|
2284 | 2284 |
2285 call StopVimInTerminal(buf) | 2285 call StopVimInTerminal(buf) |
2286 call delete('XscriptPropsWithTextAfterJoined') | 2286 call delete('XscriptPropsWithTextAfterJoined') |
2287 endfunc | 2287 endfunc |
2288 | 2288 |
2289 func Test_props_with_text_after_truncated() | |
2290 CheckRunVimInTerminal | |
2291 | |
2292 let lines =<< trim END | |
2293 call setline(1, ['one two three four five six seven']) | |
2294 call prop_type_add('afterprop', #{highlight: 'Search'}) | |
2295 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE'}) | |
2296 | |
2297 call setline(2, ['one two three four five six seven']) | |
2298 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right'}) | |
2299 | |
2300 call setline(3, ['one two three four five six seven']) | |
2301 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'}) | |
2302 | |
2303 call setline(4, ['cursor here']) | |
2304 normal 4Gfh | |
2305 END | |
2306 call writefile(lines, 'XscriptPropsWithTextAfterTrunc') | |
2307 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc', #{rows: 9, cols: 60}) | |
2308 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_1', {}) | |
2309 | |
2310 call term_sendkeys(buf, ":37vsp\<CR>gg") | |
2311 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_2', {}) | |
2312 | |
2313 call term_sendkeys(buf, ":36wincmd |\<CR>") | |
2314 call term_sendkeys(buf, "2G$") | |
2315 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_3', {}) | |
2316 | |
2317 call term_sendkeys(buf, ":33wincmd |\<CR>") | |
2318 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_4', {}) | |
2319 | |
2320 call term_sendkeys(buf, ":18wincmd |\<CR>") | |
2321 call term_sendkeys(buf, "0fx") | |
2322 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_5', {}) | |
2323 | |
2324 call StopVimInTerminal(buf) | |
2325 call delete('XscriptPropsWithTextAfterTrunc') | |
2326 endfunc | |
2327 | |
2328 func Test_props_with_text_after_wraps() | |
2329 CheckRunVimInTerminal | |
2330 | |
2331 let lines =<< trim END | |
2332 call setline(1, ['one two three four five six seven']) | |
2333 call prop_type_add('afterprop', #{highlight: 'Search'}) | |
2334 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE', text_wrap: 'wrap'}) | |
2335 | |
2336 call setline(2, ['one two three four five six seven']) | |
2337 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right', text_wrap: 'wrap'}) | |
2338 | |
2339 call setline(3, ['one two three four five six seven']) | |
2340 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'}) | |
2341 | |
2342 call setline(4, ['cursor here']) | |
2343 normal 4Gfh | |
2344 END | |
2345 call writefile(lines, 'XscriptPropsWithTextAfterWraps') | |
2346 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterWraps', #{rows: 9, cols: 60}) | |
2347 call VerifyScreenDump(buf, 'Test_prop_with_text_after_wraps_1', {}) | |
2348 | |
2349 call StopVimInTerminal(buf) | |
2350 call delete('XscriptPropsWithTextAfterWraps') | |
2351 endfunc | |
2352 | |
2289 func Test_removed_prop_with_text_cleans_up_array() | 2353 func Test_removed_prop_with_text_cleans_up_array() |
2290 new | 2354 new |
2291 call setline(1, 'some text here') | 2355 call setline(1, 'some text here') |
2292 call prop_type_add('some', #{highlight: 'ErrorMsg'}) | 2356 call prop_type_add('some', #{highlight: 'ErrorMsg'}) |
2293 let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"}) | 2357 let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"}) |