robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
dab5fab948
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , it , before_each =t . describe , t . it , t . before_each 6local set_session , clear , assert_alive =n . set_session , n . clear , n . assert_alive 7local feed , command =n . feed , n . command 8local exec , exec_lua =n . exec , n . exec_lua 9local insert =n . insert 10local eq =t . eq 11local fn , api =n . fn , n . api 12 13describe ( 'screen' , function () 14local screen 15local nvim_argv ={ 16n . nvim_prog , 17'-u' , 18'NONE' , 19'-i' , 20'NONE' , 21'-n' , 22'--cmd' , 23'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler' , 24'--cmd' , 25'colorscheme vim' , 26'--embed' , 27} 28 29before_each ( function () 30local screen_nvim =n . new_session ( false , { args =nvim_argv , merge =false } ) 31set_session ( screen_nvim ) 32screen =Screen . new () 33end ) 34 35it ( 'default initial screen' , function () 36screen : expect ( [[ 37^ | 38{1:~ }|*11 39{3:[No Name] }| 40| 41]] ) 42end ) 43end ) 44 45local function screen_tests ( linegrid ) 46local screen 47 48before_each ( function () 49clear () 50screen =Screen . new ( 53 , 14 , { rgb =true , ext_linegrid =linegrid } ) 51screen : add_extra_attr_ids ( { 52[ 100 ] ={ 53background =Screen . colors . LightGrey , 54underline =true , 55bold =true , 56foreground =Screen . colors . Fuchsia , 57} , 58[ 101 ] ={ bold =true , foreground =Screen . colors . Magenta1 } , 59} ) 60end ) 61 62describe ( 'bell/visual bell' , function () 63it ( 'is forwarded to the UI' , function () 64feed ( '<left>' ) 65screen : expect ( function () 66eq ( true , screen . bell ) 67eq ( false , screen . visual_bell ) 68end ) 69screen . bell =false 70command ( 'set visualbell' ) 71feed ( '<left>' ) 72screen : expect ( function () 73eq ( true , screen . visual_bell ) 74eq ( false , screen . bell ) 75end ) 76end ) 77end ) 78 79describe ( ':set title' , function () 80it ( 'is forwarded to the UI' , function () 81local expected ='test-title' 82command ( 'set titlestring=' .. expected ) 83command ( 'set title' ) 84screen : expect ( function () 85eq ( expected , screen . title ) 86end ) 87screen : detach () 88screen . title =nil 89screen : attach () 90screen : expect ( function () 91eq ( expected , screen . title ) 92end ) 93end ) 94end ) 95 96describe ( ':set icon' , function () 97it ( 'is forwarded to the UI' , function () 98local expected ='test-icon' 99command ( 'set iconstring=' .. expected ) 100command ( 'set icon' ) 101screen : expect ( function () 102eq ( expected , screen . icon ) 103end ) 104screen : detach () 105screen . icon =nil 106screen : attach () 107screen : expect ( function () 108eq ( expected , screen . icon ) 109end ) 110end ) 111end ) 112 113describe ( 'statusline' , function () 114it ( 'is redrawn after <c-l>' , function () 115command ( 'set laststatus=2' ) 116screen : expect ( [[ 117^ | 118{1:~ }|*11 119{3:[No Name] }| 120| 121]] ) 122 123feed ( '<c-l>' ) 124screen : expect { 125grid =[[ 126^ | 127{1:~ }|*11 128{3:[No Name] }| 129| 130]] , 131reset =true , 132} 133 134command ( 'split' ) 135screen : expect ( [[ 136^ | 137{1:~ }|*5 138{3:[No Name] }| 139| 140{1:~ }|*4 141{2:[No Name] }| 142| 143]] ) 144 145feed ( '<c-l>' ) 146screen : expect { 147grid =[[ 148^ | 149{1:~ }|*5 150{3:[No Name] }| 151| 152{1:~ }|*4 153{2:[No Name] }| 154| 155]] , 156reset =true , 157} 158end ) 159end ) 160 161describe ( 'window' , function () 162describe ( 'split' , function () 163it ( 'horizontal' , function () 164command ( 'sp' ) 165screen : expect ( [[ 166^ | 167{1:~ }|*5 168{3:[No Name] }| 169| 170{1:~ }|*4 171{2:[No Name] }| 172| 173]] ) 174end ) 175 176it ( 'horizontal and resize' , function () 177command ( 'sp' ) 178command ( 'resize 8' ) 179screen : expect ( [[ 180^ | 181{1:~ }|*7 182{3:[No Name] }| 183| 184{1:~ }|*2 185{2:[No Name] }| 186| 187]] ) 188end ) 189 190it ( 'horizontal and vertical' , function () 191command ( 'sp' ) 192command ( 'vsp' ) 193command ( 'vsp' ) 194screen : expect ( [[ 195^ │ │ | 196{1:~ }│{1:~ }│{1:~ }|*5 197{3:[No Name] }{2:[No Name] [No Name] }| 198| 199{1:~ }|*4 200{2:[No Name] }| 201| 202]] ) 203insert ( 'hello' ) 204screen : expect ( [[ 205hell^o │hello │hello | 206{1:~ }│{1:~ }│{1:~ }|*5 207{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 208hello | 209{1:~ }|*4 210{2:[No Name] [+] }| 211| 212]] ) 213end ) 214end ) 215end ) 216 217describe ( 'tabs' , function () 218it ( 'tabnew creates a new buffer' , function () 219command ( 'sp' ) 220command ( 'vsp' ) 221command ( 'vsp' ) 222insert ( 'hello' ) 223screen : expect ( [[ 224hell^o │hello │hello | 225{1:~ }│{1:~ }│{1:~ }|*5 226{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 227hello | 228{1:~ }|*4 229{2:[No Name] [+] }| 230| 231]] ) 232command ( 'tabnew' ) 233insert ( 'hello2' ) 234feed ( 'h' ) 235screen : expect ( [[ 236{24: }{100:4}{24:+ [No Name] }{5: + [No Name] }{2: }{24:X}| 237hell^o2 | 238{1:~ }|*11 239| 240]] ) 241command ( 'tabprevious' ) 242screen : expect ( [[ 243{5: }{101:4}{5:+ [No Name] }{24: + [No Name] }{2: }{24:X}| 244hell^o │hello │hello | 245{1:~ }│{1:~ }│{1:~ }|*5 246{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 247hello | 248{1:~ }|*3 249{2:[No Name] [+] }| 250| 251]] ) 252end ) 253 254it ( 'tabline is redrawn after messages' , function () 255command ( 'tabnew' ) 256screen : expect ( [[ 257{24: [No Name] }{5: [No Name] }{2: }{24:X}| 258^ | 259{1:~ }|*11 260| 261]] ) 262 263feed ( ':echo "' .. string . rep ( 'x\\n' , 11 ) .. '"<cr>' ) 264screen : expect ( [[ 265{3: }| 266x |*11 267| 268{6:Press ENTER or type command to continue}^ | 269]] ) 270 271feed ( '<cr>' ) 272screen : expect ( [[ 273{24: [No Name] }{5: [No Name] }{2: }{24:X}| 274^ | 275{1:~ }|*11 276| 277]] ) 278 279feed ( ':echo "' .. string . rep ( 'x\\n' , 12 ) .. '"<cr>' ) 280screen : expect ( [[ 281x |*12 282| 283{6:Press ENTER or type command to continue}^ | 284]] ) 285 286feed ( '<cr>' ) 287screen : expect ( [[ 288{24: [No Name] }{5: [No Name] }{2: }{24:X}| 289^ | 290{1:~ }|*11 291| 292]] ) 293end ) 294 295it ( 'redraws properly with :tab split right after scroll' , function () 296feed ( '15Ofoo<esc>15Obar<esc>gg' ) 297 298command ( 'vsplit' ) 299screen : expect ( [[ 300^foo │foo | 301foo │foo |*11 302{3:[No Name] [+] }{2:[No Name] [+] }| 303| 304]] ) 305 306feed ( '<PageDown>' ) 307screen : expect ( [[ 308^foo │foo | 309foo │foo |*3 310bar │foo |*8 311{3:[No Name] [+] }{2:[No Name] [+] }| 312| 313]] ) 314command ( 'tab split' ) 315screen : expect ( [[ 316{24: }{100:2}{24:+ [No Name] }{5: + [No Name] }{2: }{24:X}| 317^foo | 318foo |*3 319bar |*8 320| 321]] ) 322end ) 323 324it ( 'redraws unvisited tab #9152' , function () 325insert ( 'hello' ) 326-- create a tab without visiting it 327command ( 'tabnew|tabnext' ) 328screen : expect ( [[ 329{5: + [No Name] }{24: [No Name] }{2: }{24:X}| 330hell^o | 331{1:~ }|*11 332| 333]] ) 334 335feed ( 'gT' ) 336screen : expect ( [[ 337{24: + [No Name] }{5: [No Name] }{2: }{24:X}| 338^ | 339{1:~ }|*11 340| 341]] ) 342end ) 343end ) 344 345describe ( 'insert mode' , function () 346it ( 'move to next line with <cr>' , function () 347feed ( 'iline 1<cr>line 2<cr>' ) 348screen : expect ( [[ 349line 1 | 350line 2 | 351^ | 352{1:~ }|*10 353{5:-- INSERT --} | 354]] ) 355end ) 356end ) 357 358describe ( 'normal mode' , function () 359-- https://code.google.com/p/vim/issues/detail?id=339 360it ( "setting 'ruler' doesn't reset the preferred column" , function () 361command ( 'set virtualedit=' ) 362feed ( 'i0123456<cr>789<esc>kllj' ) 363command ( 'set ruler' ) 364feed ( 'k' ) 365screen : expect ( [[ 3660123^456 | 367789 | 368{1:~ }|*11 3691,5 All| 370]] ) 371end ) 372end ) 373 374describe ( 'command mode' , function () 375it ( 'typing commands' , function () 376feed ( ':ls' ) 377screen : expect ( [[ 378| 379{1:~ }|*12 380:ls^ | 381]] ) 382end ) 383 384it ( 'execute command with multi-line output' , function () 385feed ( ':ls<cr>' ) 386screen : expect ( [[ 387| 388{1:~ }|*9 389{3: }| 390:ls | 3911 %a "[No Name]" line 1 | 392{6:Press ENTER or type command to continue}^ | 393]] ) 394feed ( '<cr>' ) -- skip the "Press ENTER..." state or tests will hang 395end ) 396end ) 397 398describe ( 'scrolling and clearing' , function () 399before_each ( function () 400insert ( [[ 401Inserting 402text 403with 404many 405lines 406to 407test 408scrolling 409and 410clearing 411in 412split 413windows 414]] ) 415command ( 'sp' ) 416command ( 'vsp' ) 417command ( 'vsp' ) 418screen : expect ( [[ 419and │and │and | 420clearing │clearing │clearing | 421in │in │in | 422split │split │split | 423windows │windows │windows | 424^ │ │ | 425{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 426clearing | 427in | 428split | 429windows | 430| 431{2:[No Name] [+] }| 432| 433]] ) 434end ) 435 436it ( 'only affects the current scroll region' , function () 437feed ( '6k' ) 438screen : expect ( [[ 439^scrolling │and │and | 440and │clearing │clearing | 441clearing │in │in | 442in │split │split | 443split │windows │windows | 444windows │ │ | 445{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 446clearing | 447in | 448split | 449windows | 450| 451{2:[No Name] [+] }| 452| 453]] ) 454feed ( '<c-w>l' ) 455screen : expect ( [[ 456scrolling │and │and | 457and │clearing │clearing | 458clearing │in │in | 459in │split │split | 460split │windows │windows | 461windows │^ │ | 462{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 463clearing | 464in | 465split | 466windows | 467| 468{2:[No Name] [+] }| 469| 470]] ) 471feed ( 'gg' ) 472screen : expect ( [[ 473scrolling │^Inserting │and | 474and │text │clearing | 475clearing │with │in | 476in │many │split | 477split │lines │windows | 478windows │to │ | 479{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 480clearing | 481in | 482split | 483windows | 484| 485{2:[No Name] [+] }| 486| 487]] ) 488feed ( '7j' ) 489screen : expect ( [[ 490scrolling │with │and | 491and │many │clearing | 492clearing │lines │in | 493in │to │split | 494split │test │windows | 495windows │^scrolling │ | 496{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 497clearing | 498in | 499split | 500windows | 501| 502{2:[No Name] [+] }| 503| 504]] ) 505feed ( '2j' ) 506screen : expect ( [[ 507scrolling │lines │and | 508and │to │clearing | 509clearing │test │in | 510in │scrolling │split | 511split │and │windows | 512windows │^clearing │ | 513{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 514clearing | 515in | 516split | 517windows | 518| 519{2:[No Name] [+] }| 520| 521]] ) 522feed ( '5k' ) 523screen : expect ( [[ 524scrolling │^lines │and | 525and │to │clearing | 526clearing │test │in | 527in │scrolling │split | 528split │and │windows | 529windows │clearing │ | 530{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 531clearing | 532in | 533split | 534windows | 535| 536{2:[No Name] [+] }| 537| 538]] ) 539feed ( 'k' ) 540screen : expect ( [[ 541scrolling │^many │and | 542and │lines │clearing | 543clearing │to │in | 544in │test │split | 545split │scrolling │windows | 546windows │and │ | 547{2:[No Name] [+] }{3:[No Name] [+] }{2:<Name] [+] }| 548clearing | 549in | 550split | 551windows | 552| 553{2:[No Name] [+] }| 554| 555]] ) 556end ) 557 558it ( 'recomposes lines when floating window is positioned over scroll region' , function () 559local scroll_events =0 560local original =screen . _handle_grid_scroll 561screen . _handle_grid_scroll =function ( ... ) 562scroll_events =scroll_events + 1 563return original ( ... ) 564end 565 566local buf =api . nvim_create_buf ( false , false ) 567api . nvim_open_win ( 568buf , 569false , 570{ relative ='editor' , width =10 , height =2 , row =3 , col =0 } 571) 572 573screen : expect ( [[ 574and │and │and | 575clearing │clearing │clearing | 576in │in │in | 577{4: } │split │split | 578{11:~ } │windows │windows | 579^ │ │ | 580{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 581clearing | 582in | 583split | 584windows | 585| 586{2:[No Name] [+] }| 587| 588]] ) 589feed ( 'gg' ) 590screen : expect ( [[ 591^Inserting │and │and | 592text │clearing │clearing | 593with │in │in | 594{4: } │split │split | 595{11:~ } │windows │windows | 596to │ │ | 597{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 598clearing | 599in | 600split | 601windows | 602| 603{2:[No Name] [+] }| 604| 605]] ) 606eq ( 0 , scroll_events ) 607feed ( '<c-f>' ) 608screen : expect ( [[ 609^lines │and │and | 610to │clearing │clearing | 611test │in │in | 612{4: } │split │split | 613{11:~ } │windows │windows | 614clearing │ │ | 615{3:[No Name] [+] }{2:[No Name] [+] [No Name] [+] }| 616clearing | 617in | 618split | 619windows | 620| 621{2:[No Name] [+] }| 622| 623]] ) 624eq ( 0 , scroll_events ) 625feed ( '<c-w>jHk' ) 626screen : expect ( [[ 627lines │and │and | 628to │clearing │clearing | 629test │in │in | 630{4: } │split │split | 631{11:~ } │windows │windows | 632clearing │ │ | 633{2:[No Name] [+] [No Name] [+] [No Name] [+] }| 634^and | 635clearing | 636in | 637split | 638windows | 639{3:[No Name] [+] }| 640| 641]] ) 642eq ( 1 , scroll_events ) 643end ) 644end ) 645 646describe ( 'resize' , function () 647it ( 'rebuilds the whole screen' , function () 648screen : try_resize ( 25 , 5 ) 649feed ( 'iresize' ) 650screen : expect ( [[ 651resize^ | 652{1:~ }|*3 653{5:-- INSERT --} | 654]] ) 655end ) 656 657it ( 'has minimum width/height values' , function () 658feed ( 'iresize' ) 659screen : try_resize ( 1 , 1 ) 660screen : expect ( [[ 661resize^ | 662{5:-- INSERT --}| 663]] ) 664 665feed ( '<esc>:ls' ) 666screen : expect ( [[ 667resize | 668:ls^ | 669]] ) 670end ) 671 672it ( 'VimResized autocommand does not cause invalid UI events #20692 #20759' , function () 673screen : try_resize ( 25 , 5 ) 674feed ( 'iresize<Esc>' ) 675command ( [[autocmd VimResized * redrawtabline]] ) 676command ( [[autocmd VimResized * lua vim.api.nvim_echo({ { 'Hello' } }, false, {})]] ) 677command ( [[autocmd VimResized * let g:echospace = v:echospace]] ) 678api . nvim_set_option_value ( 'showtabline' , 2 , {} ) 679screen : expect ( [[ 680{5: + [No Name] }{2: }| 681resiz^e | 682{1:~ }|*2 683| 684]] ) 685screen : try_resize ( 30 , 6 ) 686screen : expect ( [[ 687{5: + [No Name] }{2: }| 688resiz^e | 689{1:~ }|*3 690| 691]] ) 692eq ( 29 , api . nvim_get_var ( 'echospace' )) 693end ) 694 695it ( 'messages from the same Ex command as resize are visible #22225' , function () 696feed ( ':set columns=20 | call<CR>' ) 697screen : expect ( [[ 698|*9 699{3: }| 700{9:E471: Argument requi}| 701{9:red} | 702{6:Press ENTER or type }| 703{6:command to continue}^ | 704]] ) 705feed ( '<CR>' ) 706screen : expect ( [[ 707^ | 708{1:~ }|*12 709| 710]] ) 711feed ( ':set columns=0<CR>' ) 712screen : expect ( [[ 713| 714{1:~ }|*7 715{3: }| 716{9:E594: Need at least }| 717{9:12 columns: columns=}| 718{9:0} | 719{6:Press ENTER or type }| 720{6:command to continue}^ | 721]] ) 722feed ( '<CR>' ) 723screen : expect ( [[ 724^ | 725{1:~ }|*12 726| 727]] ) 728end ) 729 730it ( 'does not crash when windows fill the screen #33883' , function () 731screen : try_resize ( 80 , 20 ) 732while true do 733local ok =pcall ( command , 'wincmd v' ) 734if not ok then 735break 736end 737end 738 739screen : try_resize ( 60 , 20 ) 740 741assert_alive () 742end ) 743 744it ( 'clamps &cmdheight for current tabpage' , function () 745command ( 'set cmdheight=10 laststatus=2' ) 746screen : expect ( [[ 747^ | 748{1:~ }|*2 749{3:[No Name] }| 750|*10 751]] ) 752screen : try_resize ( 53 , 8 ) 753screen : expect ( [[ 754^ | 755{3:[No Name] }| 756|*6 757]] ) 758eq ( 6 , api . nvim_get_option_value ( 'cmdheight' , {} )) 759end ) 760 761it ( 'clamps &cmdheight for another tabpage #31380' , function () 762command ( 'tabnew' ) 763command ( 'set cmdheight=9 laststatus=2' ) 764screen : expect ( [[ 765{24: [No Name] }{5: [No Name] }{2: }{24:X}| 766^ | 767{1:~ }|*2 768{3:[No Name] }| 769|*9 770]] ) 771command ( 'tabprev' ) 772screen : expect ( [[ 773{5: [No Name] }{24: [No Name] }{2: }{24:X}| 774^ | 775{1:~ }|*10 776{3:[No Name] }| 777| 778]] ) 779screen : try_resize ( 53 , 8 ) 780screen : expect ( [[ 781{5: [No Name] }{24: [No Name] }{2: }{24:X}| 782^ | 783{1:~ }|*4 784{3:[No Name] }| 785| 786]] ) 787command ( 'tabnext' ) 788screen : expect ( [[ 789{24: [No Name] }{5: [No Name] }{2: }{24:X}| 790^ | 791{3:[No Name] }| 792|*5 793]] ) 794eq ( 5 , api . nvim_get_option_value ( 'cmdheight' , {} )) 795end ) 796end ) 797 798describe ( 'press enter' , function () 799it ( 'does not crash on <F1> at “Press ENTER”' , function () 800command ( 'nnoremap <F1> :echo "TEST"<CR>' ) 801feed ( ':ls<CR>' ) 802screen : expect ( [[ 803| 804{1:~ }|*9 805{3: }| 806:ls | 8071 %a "[No Name]" line 1 | 808{6:Press ENTER or type command to continue}^ | 809]] ) 810feed ( '<F1>' ) 811screen : expect ( [[ 812^ | 813{1:~ }|*12 814TEST | 815]] ) 816end ) 817end ) 818 819-- Regression test for #8357 820it ( 'does not have artifacts after temporary chars in insert mode' , function () 821command ( 'set timeoutlen=10000' ) 822command ( 'inoremap jk <esc>' ) 823feed ( 'ifooj' ) 824screen : expect ( [[ 825foo^j | 826{1:~ }|*12 827{5:-- INSERT --} | 828]] ) 829feed ( 'k' ) 830screen : expect ( [[ 831fo^o | 832{1:~ }|*12 833| 834]] ) 835end ) 836end 837 838describe ( 'Screen (char-based)' , function () 839screen_tests ( false ) 840end ) 841 842describe ( 'Screen (line-based)' , function () 843screen_tests ( true ) 844end ) 845 846describe ( 'Screen default colors' , function () 847local screen 848local function startup ( light , termcolors ) 849local extra =( light and ' background=light' ) or '' 850 851local nvim_argv ={ 852n . nvim_prog , 853'-u' , 854'NONE' , 855'-i' , 856'NONE' , 857'-N' , 858'--cmd' , 859'set shortmess+=I noswapfile belloff= noshowcmd noruler' .. extra , 860'--cmd' , 861'colorscheme vim' , 862'--embed' , 863} 864local screen_nvim =n . new_session ( false , { args =nvim_argv , merge =false } ) 865set_session ( screen_nvim ) 866screen =Screen . new ( 53 , 14 , { rgb =true , ext_termcolors =termcolors or nil } ) 867end 868 869it ( 'are dark per default' , function () 870startup ( false , false ) 871screen : expect ( function () 872eq ( { 873rgb_bg =0 , 874rgb_fg =Screen . colors . White , 875rgb_sp =Screen . colors . Red , 876cterm_bg =0 , 877cterm_fg =0 , 878} , screen . default_colors ) 879end ) 880end ) 881 882it ( 'can be set to light' , function () 883startup ( true , false ) 884screen : expect ( function () 885eq ( { 886rgb_bg =Screen . colors . White , 887rgb_fg =0 , 888rgb_sp =Screen . colors . Red , 889cterm_bg =0 , 890cterm_fg =0 , 891} , screen . default_colors ) 892end ) 893end ) 894 895it ( 'can be handled by external terminal' , function () 896local colors ={ rgb_bg =- 1 , rgb_fg =- 1 , rgb_sp =- 1 , cterm_bg =0 , cterm_fg =0 } 897startup ( false , true ) 898screen : expect ( function () 899eq ( colors , screen . default_colors ) 900end ) 901 902startup ( true , true ) 903screen : expect ( function () 904eq ( colors , screen . default_colors ) 905end ) 906end ) 907end ) 908 909local screen 910before_each ( function () 911clear () 912screen =Screen . new () 913end ) 914 915it ( 'CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605' , function () 916screen : try_resize ( 100 , 100 ) 917eq ( 100 , api . nvim_get_option_value ( 'lines' , {} )) 918eq ( 99 , api . nvim_get_option_value ( 'window' , {} )) 919eq ( 99 , api . nvim_win_get_height ( 0 )) 920feed ( '1000o<Esc>' ) 921eq ( 903 , fn . line ( 'w0' )) 922feed ( '<C-B>' ) 923eq ( 806 , fn . line ( 'w0' )) 924feed ( '<C-B>' ) 925eq ( 709 , fn . line ( 'w0' )) 926feed ( '<C-F>' ) 927eq ( 806 , fn . line ( 'w0' )) 928feed ( '<C-F>' ) 929eq ( 903 , fn . line ( 'w0' )) 930feed ( 'G' ) 931screen : try_resize ( 50 , 50 ) 932eq ( 50 , api . nvim_get_option_value ( 'lines' , {} )) 933eq ( 49 , api . nvim_get_option_value ( 'window' , {} )) 934eq ( 49 , api . nvim_win_get_height ( 0 )) 935eq ( 953 , fn . line ( 'w0' )) 936feed ( '<C-B>' ) 937eq ( 906 , fn . line ( 'w0' )) 938feed ( '<C-B>' ) 939eq ( 859 , fn . line ( 'w0' )) 940feed ( '<C-F>' ) 941eq ( 906 , fn . line ( 'w0' )) 942feed ( '<C-F>' ) 943eq ( 953 , fn . line ( 'w0' )) 944end ) 945 946it ( "showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593" , function () 947command ( 'set showcmd redrawdebug=compositor' ) 948feed ( 'd' ) 949screen : expect ( [[ 950^ | 951{1:~ }|*12 952d | 953]] ) 954end ) 955 956it ( "scrolling in narrow window doesn't draw over separator #29033" , function () 957screen : try_resize ( 60 , 8 ) 958feed ( '100Oa<Esc>gg' ) 959exec ( [[ 960set number nowrap 961vsplit 962set scrollbind 963wincmd l 964set scrollbind 965wincmd | 966]] ) 967screen : expect ( [[ 968{8: }│{8: 1 }^a | 969{8: }│{8: 2 }a | 970{8: }│{8: 3 }a | 971{8: }│{8: 4 }a | 972{8: }│{8: 5 }a | 973{8: }│{8: 6 }a | 974{2:< }{3:[No Name] [+] }| 975| 976]] ) 977feed ( '<C-F>' ) 978screen : expect ( [[ 979{8: }│{8: 5 }^a | 980{8: }│{8: 6 }a | 981{8: }│{8: 7 }a | 982{8: }│{8: 8 }a | 983{8: }│{8: 9 }a | 984{8: }│{8: 10 }a | 985{2:< }{3:[No Name] [+] }| 986| 987]] ) 988end ) 989 990it ( 'hidden windows are not redrawn' , function () 991clear () 992local screen =Screen . new () 993local opts ={ width =5 , height =5 , bufpos ={ 0 , 0 } , relative ='win' , hide =true } 994local win =api . nvim_open_win ( 0 , false , opts ) 995local no_redraw =function () 996vim . o . laststatus =3 997local on_win =function ( _ , winid ) 998_G . did_win =( _G . did_win or 0 ) + ( winid == win and 1 or 0 ) 999end 1000vim . api . nvim_set_decoration_provider ( 1 , { on_win =on_win } ) 1001vim . api . nvim__redraw ( { flush =true } ) 1002return _G . did_win 1003end 1004eq ( 0 , exec_lua ( no_redraw )) 1005screen : expect ( [[ 1006^ | 1007{1:~ }|*11 1008{3:[No Name] }| 1009| 1010]] ) 1011-- Redrawn properly after unhiding 1012api . nvim_win_set_config ( win , { hide =false } ) 1013screen : expect ( [[ 1014^ | 1015{4: }{1: }| 1016{11:~ }{1: }|*4 1017{1:~ }|*6 1018{3:[No Name] }| 1019| 1020]] ) 1021end )