robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1" Test for displaying stuff 2 3" Nvim: `:set term` is not supported. 4" if !has('gui_running') && has('unix') 5" set term=ansi 6" endif 7 8source view_util.vim 9source check.vim 10source screendump.vim 11 12func Test_display_foldcolumn () 13CheckFeature folding 14 15new 16vnew 17vert resize 25 18call assert_equal ( 25 , winwidth ( winnr ())) 19" does not affect test behavior, <82> is unprintable by default: 20" set isprint=@ 21 221 put ='e more noise blah blah more stuff here' 23 24let expect = [ 25 \"e more noise blah blah<82" , 26 \"> more stuff here " 27 \] 28 29call cursor ( 2 , 1 ) 30norm ! zt 31let lines = ScreenLines ([ 1 , 2 ], winwidth ( 0 )) 32call assert_equal ( expect , lines ) 33set fdc = 2 34let lines = ScreenLines ([ 1 , 2 ], winwidth ( 0 )) 35let expect = [ 36 \" e more noise blah blah<" , 37 \" 82> more stuff here " 38 \] 39call assert_equal ( expect , lines ) 40 41quit ! 42quit ! 43endfunc 44 45func Test_display_foldtext_mbyte () 46CheckFeature folding 47 48call NewWindow ( 10 , 40 ) 49call append ( 0 , range ( 1 , 20 )) 50exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2" 51call cursor ( 2 , 1 ) 52norm ! zf13G 53let lines = ScreenLines ([ 1 , 3 ], winwidth ( 0 ) + 1 ) 54let expect = [ 55 \" 1 \u2502" , 56 \"+ +-- 12 lines: 2" . repeat ( "\u2500" , 23 ) . "\u2502" , 57 \" 14 \u2502" , 58 \] 59call assert_equal ( expect , lines ) 60 61set fillchars = fold:-,vert:\| 62let lines = ScreenLines ([ 1 , 3 ], winwidth ( 0 ) + 1 ) 63let expect = [ 64 \" 1 |" , 65 \"+ +-- 12 lines: 2" . repeat ( "-" , 23 ) . "|" , 66 \" 14 |" , 67 \] 68call assert_equal ( expect , lines ) 69 70set foldtext & fillchars & foldmethod & fdc & 71bw ! 72endfunc 73 74" check that win_ins_lines() and win_del_lines() work when t_cs is empty. 75func Test_scroll_without_region () 76CheckScreendump 77 78let lines =<< trim END 79call setline(1, range(1, 20)) 80set t_cs= 81set laststatus=2 82END 83call writefile ( lines , 'Xtestscroll' , 'D' ) 84let buf = RunVimInTerminal ( '-S Xtestscroll' , #{ rows : 10 }) 85 86call VerifyScreenDump ( buf , 'Test_scroll_no_region_1' , {}) 87 88call term_sendkeys ( buf , ":3delete\<cr>" ) 89call VerifyScreenDump ( buf , 'Test_scroll_no_region_2' , {}) 90 91call term_sendkeys ( buf , ":4put\<cr>" ) 92call VerifyScreenDump ( buf , 'Test_scroll_no_region_3' , {}) 93 94call term_sendkeys ( buf , ":undo\<cr>" ) 95call term_sendkeys ( buf , ":undo\<cr>" ) 96call term_sendkeys ( buf , ":set laststatus=0\<cr>" ) 97call VerifyScreenDump ( buf , 'Test_scroll_no_region_4' , {}) 98 99call term_sendkeys ( buf , ":3delete\<cr>" ) 100call VerifyScreenDump ( buf , 'Test_scroll_no_region_5' , {}) 101 102call term_sendkeys ( buf , ":4put\<cr>" ) 103call VerifyScreenDump ( buf , 'Test_scroll_no_region_6' , {}) 104 105" clean up 106call StopVimInTerminal ( buf ) 107endfunc 108 109func Test_display_listchars_precedes () 110call NewWindow ( 10 , 10 ) 111" Need a physical line that wraps over the complete 112" window size 113call append ( 0 , repeat ( 'aaa aaa aa ' , 10 )) 114call append ( 1 , repeat ([ 'bbb bbb bbb bbb' ], 2 )) 115" remove blank trailing line 116$ d 117set list nowrap 118call cursor ( 1 , 1 ) 119" move to end of line and scroll 2 characters back 120norm ! $2zh 121let lines = ScreenLines ([ 1 , 4 ], winwidth ( 0 ) + 1 ) 122let expect = [ 123 \" aaa aa $ |" , 124 \"$ |" , 125 \"$ |" , 126 \"~ |" , 127 \] 128call assert_equal ( expect , lines ) 129set list listchars += precedes:<nowrap 130call cursor ( 1 , 1 ) 131" move to end of line and scroll 2 characters back 132norm ! $2zh 133let lines = ScreenLines ([ 1 , 4 ], winwidth ( 0 ) + 1 ) 134let expect = [ 135 \"<aaa aa $ |" , 136 \"< |" , 137 \"< |" , 138 \"~ |" , 139 \] 140call assert_equal ( expect , lines ) 141set wrap 142call cursor ( 1 , 1 ) 143" the complete line should be displayed in the window 144norm ! $ 145 146let lines = ScreenLines ([ 1 , 10 ], winwidth ( 0 ) + 1 ) 147let expect = [ 148 \"<aaa aaa a|" , 149 \"a aaa aaa |" , 150 \"aa aaa aaa|" , 151 \" aa aaa aa|" , 152 \"a aa aaa a|" , 153 \"aa aa aaa |" , 154 \"aaa aa aaa|" , 155 \" aaa aa aa|" , 156 \"a aaa aa a|" , 157 \"aa aaa aa |" , 158 \] 159call assert_equal ( expect , lines ) 160set list & listchars & wrap & 161bw ! 162endfunc 163 164" Check that win_lines() works correctly with the number_only parameter=TRUE 165" should break early to optimize cost of drawing, but needs to make sure 166" that the number column is correctly highlighted. 167func Test_scroll_CursorLineNr_update () 168CheckScreendump 169 170let lines =<< trim END 171hi CursorLineNr ctermfg=73 ctermbg=236 172set nu rnu cursorline cursorlineopt=number 173exe ":norm! o\<esc>110ia\<esc>" 174END 175let filename = 'Xdrawscreen' 176call writefile ( lines , filename , 'D' ) 177let buf = RunVimInTerminal ( '-S ' . filename , #{ rows : 5 , cols : 50 }) 178call term_sendkeys ( buf , "k" ) 179call VerifyScreenDump ( buf , 'Test_winline_rnu' , {}) 180 181" clean up 182call StopVimInTerminal ( buf ) 183endfunc 184 185" check a long file name does not result in the hit-enter prompt 186func Test_edit_long_file_name () 187CheckScreendump 188 189let longName = 'x' ->repeat ( min ([ & columns , 255 ])) 190call writefile ([], longName , 'D' ) 191let buf = RunVimInTerminal ( '-N -u NONE --cmd ":set noshowcmd noruler" ' .. longName , #{ rows : 8 }) 192 193call VerifyScreenDump ( buf , 'Test_long_file_name_1' , {}) 194 195call term_sendkeys ( buf , ":set showcmd\<cr>:e!\<cr>" ) 196call VerifyScreenDump ( buf , 'Test_long_file_name_2' , {}) 197 198" clean up 199call StopVimInTerminal ( buf ) 200set ruler & vim 201endfunc 202 203func Test_edit_long_file_name_with_ruler () 204CheckScreendump 205 206let longName = 'x' ->repeat ( min ([ & columns , 255 ])) 207call writefile ([], longName , 'D' ) 208let buf = RunVimInTerminal ( '-N -u NONE --cmd ":set noshowcmd" ' .. longName , #{ rows : 8 }) 209 210call VerifyScreenDump ( buf , 'Test_long_file_name_3' , {}) 211 212call term_sendkeys ( buf , ":set showcmd\<cr>:e!\<cr>" ) 213call VerifyScreenDump ( buf , 'Test_long_file_name_4' , {}) 214 215" clean up 216call StopVimInTerminal ( buf ) 217endfunc 218 219func Test_unprintable_fileformats () 220CheckScreendump 221 222call writefile ([ "unix\r" , "two" ], 'Xunix.txt' , 'D' ) 223call writefile ([ "mac\r" , "two" ], 'Xmac.txt' , 'D' ) 224let lines =<< trim END 225edit Xunix.txt 226split Xmac.txt 227edit ++ff=mac 228END 229let filename = 'Xunprintable' 230call writefile ( lines , filename , 'D' ) 231let buf = RunVimInTerminal ( '-S ' . filename , #{ rows : 9 , cols : 50 }) 232call VerifyScreenDump ( buf , 'Test_display_unprintable_01' , {}) 233call term_sendkeys ( buf , "\<C-W>\<C-W>\<C-L>" ) 234call VerifyScreenDump ( buf , 'Test_display_unprintable_02' , {}) 235 236" clean up 237call StopVimInTerminal ( buf ) 238endfunc 239 240func Test_display_scroll_at_topline () 241CheckScreendump 242 243let buf = RunVimInTerminal ( '' , #{ cols : 20 }) 244call term_sendkeys ( buf , ":call setline(1, repeat('a', 21))\<CR>" ) 245call TermWait ( buf ) 246call term_sendkeys ( buf , "O\<Esc>" ) 247call VerifyScreenDump ( buf , 'Test_display_scroll_at_topline' , #{ rows : 4 }) 248 249call StopVimInTerminal ( buf ) 250endfunc 251 252func Test_display_scroll_update_visual () 253CheckScreendump 254 255let lines =<< trim END 256set scrolloff=0 257call setline(1, repeat(['foo'], 10)) 258call sign_define('foo', { 'text': '>' }) 259call sign_place(1, 'bar', 'foo', bufnr(), { 'lnum': 2 }) 260call sign_place(2, 'bar', 'foo', bufnr(), { 'lnum': 1 }) 261autocmd CursorMoved * if getcurpos()[1] == 2 | call sign_unplace('bar', { 'id': 1 }) | endif 262END 263call writefile ( lines , 'XupdateVisual.vim' , 'D' ) 264 265let buf = RunVimInTerminal ( '-S XupdateVisual.vim' , #{ rows : 8 , cols : 60 }) 266call term_sendkeys ( buf , "VG7kk" ) 267call WaitForAssert ({ ->assert_match ( 'VISUAL.*\d\+\s\+\d' , term_getline ( buf , 8 ))}, 1000 ) 268call VerifyScreenDump ( buf , 'Test_display_scroll_update_visual' , {}) 269 270call StopVimInTerminal ( buf ) 271endfunc 272 273func Test_display_scroll_setline () 274CheckScreendump 275 276let lines =<< trim END 277setlocal scrolloff=5 signcolumn=yes 278call setline(1, range(1, 100)) 279call sign_define('foo', #{text: '>'}) 280call sign_place(1, 'bar', 'foo', bufnr(), #{lnum: 71}) 281call sign_place(2, 'bar', 'foo', bufnr(), #{lnum: 72}) 282call sign_place(3, 'bar', 'foo', bufnr(), #{lnum: 73}) 283call sign_place(4, 'bar', 'foo', bufnr(), #{lnum: 74}) 284call sign_place(5, 'bar', 'foo', bufnr(), #{lnum: 75}) 285normal! G 286autocmd CursorMoved * if line('.') == 79 287\ | call sign_unplace('bar', #{id: 4}) 288\ | call setline(80, repeat('foo', 15)) 289\ | elseif line('.') == 78 290\ | call setline(72, repeat('bar', 10)) 291\ | elseif line('.') == 77 292\ | call sign_unplace('bar', #{id: 2}) 293\ | endif 294END 295call writefile ( lines , 'XscrollSetline.vim' , 'D' ) 296 297let buf = RunVimInTerminal ( '-S XscrollSetline.vim' , #{ rows : 15 , cols : 20 }) 298call VerifyScreenDump ( buf , 'Test_display_scroll_setline_1' , {}) 299call term_sendkeys ( buf , '19k' ) 300call VerifyScreenDump ( buf , 'Test_display_scroll_setline_2' , {}) 301call term_sendkeys ( buf , 'k' ) 302call VerifyScreenDump ( buf , 'Test_display_scroll_setline_3' , {}) 303call term_sendkeys ( buf , 'k' ) 304call VerifyScreenDump ( buf , 'Test_display_scroll_setline_4' , {}) 305call term_sendkeys ( buf , 'k' ) 306call VerifyScreenDump ( buf , 'Test_display_scroll_setline_5' , {}) 307call term_sendkeys ( buf , 'k' ) 308call VerifyScreenDump ( buf , 'Test_display_scroll_setline_6' , {}) 309 310call StopVimInTerminal ( buf ) 311endfunc 312 313func Test_display_hit_enter_setline () 314CheckScreendump 315 316let lines =<< trim END 317call setline(1, range(1, 100)) 318END 319call writefile ( lines , 'XhitEnterSetline.vim' , 'D' ) 320 321let buf = RunVimInTerminal ( '-S XhitEnterSetline.vim' , #{ rows : 8 , cols : 40 }) 322call VerifyScreenDump ( buf , 'Test_display_hit_enter_setline_1' , {}) 323call term_sendkeys ( buf , ':echo "abc\ndef\nghi"' ) 324call term_sendkeys ( buf , "\<CR>" ) 325call VerifyScreenDump ( buf , 'Test_display_hit_enter_setline_2' , {}) 326call term_sendkeys ( buf , ":call setline(2, repeat('foo', 35))\<CR>" ) 327call VerifyScreenDump ( buf , 'Test_display_hit_enter_setline_3' , {}) 328 329call StopVimInTerminal ( buf ) 330endfunc 331 332" Test for 'eob' (EndOfBuffer) item in 'fillchars' 333func Test_eob_fillchars () 334" default value 335" call assert_match('eob:\~', &fillchars) 336" invalid values 337call assert_fails ( ':set fillchars=eob:' , 'E1511:' ) 338call assert_fails ( ':set fillchars=eob:xy' , 'E1511:' ) 339call assert_fails ( ':set fillchars=eob:\255' , 'E1511:' ) 340call assert_fails ( ':set fillchars=eob:<ff>' , 'E1511:' ) 341call assert_fails ( ":set fillchars=eob:\x01" , 'E1512:' ) 342call assert_fails ( ':set fillchars=eob:\\x01' , 'E1512:' ) 343" default is ~ 344new 345redraw 346call assert_equal ( '~' , Screenline ( 2 )) 347set fillchars = eob:+ 348redraw 349call assert_equal ( '+' , Screenline ( 2 )) 350let & fillchars = 'eob: ' 351redraw 352call assert_equal ( ' ' , nr2char ( screenchar ( 2 , 1 ))) 353set fillchars & 354close 355endfunc 356 357" Test for 'foldopen', 'foldclose' and 'foldsep' in 'fillchars' 358func Test_fold_fillchars () 359new 360set fdc = 2 foldenable foldmethod = manual 361call setline ( 1 , [ 'one' , 'two' , 'three' , 'four' , 'five' ]) 3622 , 4 fold 363" First check for the default setting for a closed fold 364let lines = ScreenLines ([ 1 , 3 ], 8 ) 365let expected = [ 366 \' one ' , 367 \'+ +-- 3' , 368 \' five ' 369 \] 370call assert_equal ( expected , lines ) 371normal 2Gzo 372" check the characters for an open fold 373let lines = ScreenLines ([ 1 , 5 ], 8 ) 374let expected = [ 375 \' one ' , 376 \'- two ' , 377 \'| three ' , 378 \'| four ' , 379 \' five ' 380 \] 381call assert_equal ( expected , lines ) 382 383" change the setting 384set fillchars = vert:\|,fold:-,eob:~,foldopen:[,foldclose:],foldsep:- 385 386" check the characters for an open fold 387let lines = ScreenLines ([ 1 , 5 ], 8 ) 388let expected = [ 389 \' one ' , 390 \'[ two ' , 391 \'- three ' , 392 \'- four ' , 393 \' five ' 394 \] 395call assert_equal ( expected , lines ) 396 397" check the characters for a closed fold 398normal 2Gzc 399let lines = ScreenLines ([ 1 , 3 ], 8 ) 400let expected = [ 401 \' one ' , 402 \'] +-- 3' , 403 \' five ' 404 \] 405call assert_equal ( expected , lines ) 406 407set fdc = 1 foldmethod = indentfoldlevel = 10 408call setline ( 1 , [ 'one' , ' two' , ' two' , ' three' , ' three' , 'four' ]) 409let lines = ScreenLines ([ 1 , 6 ], 22 ) 410let expected = [ 411 \' one ' , 412 \'[ two ' , 413 \'- two ' , 414 \'[ three' , 415 \'2 three' , 416 \' four ' , 417 \] 418call assert_equal ( expected , lines ) 419 420" check setting foldinner 421let & fillchars = & fillchars .. ',foldinner: ' 422let lines = ScreenLines ([ 1 , 6 ], 22 ) 423let expected = [ 424 \' one ' , 425 \'[ two ' , 426 \'- two ' , 427 \'[ three' , 428 \' three' , 429 \' four ' , 430 \] 431call assert_equal ( expected , lines ) 432 433" check Unicode chars 434set fillchars = foldopen:▼,foldclose:▶,fold:⋯,foldsep:‖,foldinner:⋮ 435let lines = ScreenLines ([ 1 , 6 ], 22 ) 436let expected = [ 437 \' one ' , 438 \'▼ two ' , 439 \'‖ two ' , 440 \'▼ three' , 441 \'⋮ three' , 442 \' four ' , 443 \] 444call assert_equal ( expected , lines ) 445 446set fillchars -= foldinner:⋮ 447let lines = ScreenLines ([ 1 , 6 ], 22 ) 448let expected = [ 449 \' one ' , 450 \'▼ two ' , 451 \'‖ two ' , 452 \'▼ three' , 453 \'2 three' , 454 \' four ' , 455 \] 456call assert_equal ( expected , lines ) 457 458normal ! 5ggzc 459let lines = ScreenLines ([ 1 , 5 ], 24 ) 460let expected = [ 461 \' one ' , 462 \'▼ two ' , 463 \'‖ two ' , 464 \'▶+--- 2 lines: three⋯⋯⋯' , 465 \' four ' , 466 \] 467call assert_equal ( expected , lines ) 468 469 %bw ! 470set fillchars & fdc & foldmethod & foldenable & 471endfunc 472 473func Test_local_fillchars () 474CheckScreendump 475 476let lines =<< trim END 477call setline(1, ['window 1']->repeat(3)) 478setlocal fillchars=stl:1,stlnc:a,vert:=,eob:x 479vnew 480call setline(1, ['window 2']->repeat(3)) 481setlocal fillchars=stl:2,stlnc:b,vert:+,eob:y 482new 483wincmd J 484call setline(1, ['window 3']->repeat(3)) 485setlocal fillchars=stl:3,stlnc:c,vert:<,eob:z 486vnew 487call setline(1, ['window 4']->repeat(3)) 488setlocal fillchars=stl:4,stlnc:d,vert:>,eob:o 489END 490call writefile ( lines , 'Xdisplayfillchars' , 'D' ) 491let buf = RunVimInTerminal ( '-S Xdisplayfillchars' , #{ rows : 12 }) 492call VerifyScreenDump ( buf , 'Test_display_fillchars_1' , {}) 493 494call term_sendkeys ( buf , ":wincmd k\r" ) 495call VerifyScreenDump ( buf , 'Test_display_fillchars_2' , {}) 496 497call StopVimInTerminal ( buf ) 498endfunc 499 500func Test_fillchars_vert_default () 501CheckScreendump 502 503let lines =<< trim END 504hi VertSplit ctermfg=12 ctermbg=0 505set fillchars=trunc:< 506call setline(1, ['window 1']->repeat(3)) 507vnew 508call setline(1, ['window 2']->repeat(3)) 509END 510call writefile ( lines , 'Xdisplayfillcharsvert' , 'D' ) 511let buf = RunVimInTerminal ( '-S Xdisplayfillcharsvert' , #{ rows : 8 }) 512call VerifyScreenDump ( buf , 'Test_display_fillchars_vert' , {}) 513 514call StopVimInTerminal ( buf ) 515endfunc 516 517func Test_display_linebreak_breakat () 518new 519vert resize 25 520let _breakat = & breakat 521setl signcolumn = yeslinebreak breakat = )showbreak = ++ 522call setline ( 1 , repeat ( 'x' , winwidth ( 0 ) - 2 ) .. ')abc' ) 523let lines = ScreenLines ([ 1 , 2 ], 25 ) 524let expected = [ 525 \' xxxxxxxxxxxxxxxxxxxxxxx' , 526 \' ++)abc ' , 527 \] 528call assert_equal ( expected , lines ) 529setl breakindent breakindentopt = shift:2 530let lines = ScreenLines ([ 1 , 2 ], 25 ) 531let expected = [ 532 \' xxxxxxxxxxxxxxxxxxxxxxx' , 533 \' ++)abc ' , 534 \] 535call assert_equal ( expected , lines ) 536 %bw ! 537let & breakat = _breakat 538endfunc 539 540func Run_Test_display_lastline ( euro ) 541CheckScreendump 542 543let lines =<< trim END 544call setline(1, ['aaa', 'b'->repeat(200)]) 545set display=truncate 546 547vsplit 548100wincmd < 549END 550if a: euro != '' 551let lines [ 2 ] = 'set fillchars=vert:\|,lastline:€' 552endif 553call writefile ( lines , 'XdispLastline' , 'D' ) 554let buf = RunVimInTerminal ( '-S XdispLastline' , #{ rows : 10 }) 555call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}1', {}) 556 557call term_sendkeys ( buf , ":set display=lastline\<CR>" ) 558call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}2', {}) 559 560call term_sendkeys ( buf , ":100wincmd >\<CR>" ) 561call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}3', {}) 562 563call term_sendkeys ( buf , ":set display=truncate\<CR>" ) 564call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}4', {}) 565 566call term_sendkeys ( buf , ":close\<CR>" ) 567call term_sendkeys ( buf , ":3split\<CR>" ) 568call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}5', {}) 569 570call term_sendkeys ( buf , ":close\<CR>" ) 571call term_sendkeys ( buf , ":2vsplit\<CR>" ) 572call VerifyScreenDump ( buf , $ 'Test_display_lastline_{a:euro}6', {}) 573 574call StopVimInTerminal ( buf ) 575endfunc 576 577func Test_display_lastline_dump () 578CheckScreendump 579 580call Run_Test_display_lastline ( '' ) 581call Run_Test_display_lastline ( 'euro_' ) 582endfunc 583 584func Test_display_lastline_fails () 585call assert_fails ( ':set fillchars=lastline:' , 'E1511:' ) 586call assert_fails ( ':set fillchars=lastline:〇' , 'E1512:' ) 587endfunc 588 589func Test_display_long_lastline () 590CheckScreendump 591 592let lines =<< trim END 593set display=lastline smoothscroll scrolloff=0 594call setline(1, [ 595\'aaaaa'->repeat(150), 596\'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7) 597\]) 598END 599 600call writefile ( lines , 'XdispLongline' , 'D' ) 601let buf = RunVimInTerminal ( '-S XdispLongline' , #{ rows : 14 , cols : 35 }) 602 603call term_sendkeys ( buf , "736|" ) 604call VerifyScreenDump ( buf , 'Test_display_long_line_1' , {}) 605 606" The correct part of the last line is moved into view. 607call term_sendkeys ( buf , "D" ) 608call VerifyScreenDump ( buf , 'Test_display_long_line_2' , {}) 609 610" "w_skipcol" does not change because the topline is still long enough 611" to maintain the current skipcol. 612call term_sendkeys ( buf , "g04l11gkD" ) 613call VerifyScreenDump ( buf , 'Test_display_long_line_3' , {}) 614 615" "w_skipcol" is reset to bring the entire topline into view because 616" the line length is now smaller than the current skipcol + marker. 617call term_sendkeys ( buf , "x" ) 618call VerifyScreenDump ( buf , 'Test_display_long_line_4' , {}) 619 620call StopVimInTerminal ( buf ) 621endfunc 622 623" Moving the cursor to a line that doesn't fit in the window should show 624" correctly. 625func Test_display_cursor_long_line () 626CheckScreendump 627 628let lines =<< trim END 629call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c']) 630norm $j 631END 632 633call writefile ( lines , 'XdispCursorLongline' , 'D' ) 634let buf = RunVimInTerminal ( '-S XdispCursorLongline' , #{ rows : 8 }) 635 636call VerifyScreenDump ( buf , 'Test_display_cursor_long_line_1' , {}) 637 638" FIXME: moving the cursor above the topline does not set w_skipcol 639" correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1). 640call term_sendkeys ( buf , ":set number cpo+=n scrolloff=0\<CR>" ) 641call term_sendkeys ( buf , '$0' ) 642call VerifyScreenDump ( buf , 'Test_display_cursor_long_line_2' , {}) 643 644" Going to the start of the line with "b" did not set w_skipcol correctly 645" with 'smoothscroll'. 646call term_sendkeys ( buf , ":set smoothscroll\<CR>" ) 647call term_sendkeys ( buf , '$b' ) 648call VerifyScreenDump ( buf , 'Test_display_cursor_long_line_3' , {}) 649" Same for "ge". 650call term_sendkeys ( buf , '$ge' ) 651call VerifyScreenDump ( buf , 'Test_display_cursor_long_line_4' , {}) 652 653call StopVimInTerminal ( buf ) 654endfunc 655 656func Test_change_wrapped_line_cpo_dollar () 657CheckScreendump 658 659let lines =<< trim END 660set cpoptions+=$ laststatus=0 661call setline(1, ['foo', 'bar', 662\ repeat('x', 25) .. '!!()!!' .. repeat('y', 25), 663\ 'FOO', 'BAR']) 664inoremap <F2> <Cmd>call setline(1, repeat('z', 30))<CR> 665inoremap <F3> <Cmd>call setline(1, 'foo')<CR> 666vsplit 667call cursor(3, 1) 668END 669call writefile ( lines , 'Xwrapped_cpo_dollar' , 'D' ) 670let buf = RunVimInTerminal ( '-S Xwrapped_cpo_dollar' , #{ rows : 10 , cols : 45 }) 671 672call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_01' , {}) 673call term_sendkeys ( buf , 'ct!' ) 674call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_02' , {}) 675call term_sendkeys ( buf , "\<F2>" ) 676call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_03' , {}) 677call term_sendkeys ( buf , "\<F3>" ) 678call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_02' , {}) 679call term_sendkeys ( buf , 'y' ) 680call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_04' , {}) 681call term_sendkeys ( buf , 'y' ) 682call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_05' , {}) 683call term_sendkeys ( buf , "\<Esc>" ) 684call TermWait ( buf , 50 ) 685call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_06' , {}) 686 687call term_sendkeys ( buf , ":silent undo | echo\<CR>" ) 688call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_01' , {}) 689call term_sendkeys ( buf , ":source samples/matchparen.vim\<CR>" ) 690call term_sendkeys ( buf , 'ct(' ) 691call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_07' , {}) 692call term_sendkeys ( buf , 'y' ) 693call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_08' , {}) 694call term_sendkeys ( buf , 'y' ) 695call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_09' , {}) 696call term_sendkeys ( buf , "\<Esc>" ) 697call TermWait ( buf , 50 ) 698call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_10' , {}) 699 700call term_sendkeys ( buf , ":silent undo | echo\<CR>" ) 701call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_01' , {}) 702call term_sendkeys ( buf , "f(azz\<CR>zz\<Esc>k0" ) 703call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_11' , {}) 704call term_sendkeys ( buf , 'ct(' ) 705call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_12' , {}) 706call term_sendkeys ( buf , 'y' ) 707call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_13' , {}) 708call term_sendkeys ( buf , 'y' ) 709call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_14' , {}) 710call term_sendkeys ( buf , "\<Esc>" ) 711call TermWait ( buf , 50 ) 712call VerifyScreenDump ( buf , 'Test_change_wrapped_line_cpo_dollar_15' , {}) 713 714call StopVimInTerminal ( buf ) 715endfunc 716 717" vim: shiftwidth=2 sts=2 expandtab