robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
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 , pending =t . describe , t . it , t . before_each , t . pending 6local clear , feed =n . clear , n . feed 7local source =n . source 8local command =n . command 9local assert_alive =n . assert_alive 10local poke_eventloop =n . poke_eventloop 11local exec =n . exec 12local eval =n . eval 13local eq =t . eq 14local is_os =t . is_os 15local api =n . api 16 17local function test_cmdline ( linegrid ) 18local screen 19 20before_each ( function () 21clear () 22screen =Screen . new ( 25 , 5 , { rgb =true , ext_cmdline =true , ext_linegrid =linegrid } ) 23end ) 24 25it ( 'works' , function () 26feed ( ':' ) 27screen : expect { 28grid =[[ 29^ | 30{1:~ }|*3 31| 32]] , 33cmdline ={ { firstc =':' , content ={ { '' } } , pos =0 } } , 34} 35 36feed ( 'sign' ) 37screen : expect { 38grid =[[ 39^ | 40{1:~ }|*3 41| 42]] , 43cmdline ={ { firstc =':' , content ={ { 'sign' } } , pos =4 } } , 44} 45 46feed ( '<Left>' ) 47screen : expect { 48grid =[[ 49^ | 50{1:~ }|*3 51| 52]] , 53cmdline ={ { firstc =':' , content ={ { 'sign' } } , pos =3 } } , 54} 55 56feed ( '<bs>' ) 57screen : expect { 58grid =[[ 59^ | 60{1:~ }|*3 61| 62]] , 63cmdline ={ { firstc =':' , content ={ { 'sin' } } , pos =2 } } , 64} 65 66feed ( '<Esc>' ) 67screen : expect { 68grid =[[ 69^ | 70{1:~ }|*3 71| 72]] , 73cmdline ={ { abort =true } } , 74} 75end ) 76 77it ( 'works with input()' , function () 78feed ( ':call input("input", "default")<cr>' ) 79screen : expect ( { 80grid =[[ 81^ | 82{1:~ }|*3 83| 84]] , 85cmdline ={ { content ={ { 'default' } } , pos =7 , prompt ='input' } } , 86} ) 87 88feed ( '<cr>' ) 89screen : expect_unchanged () 90end ) 91 92it ( 'works with special chars and nested cmdline' , function () 93feed ( ':xx<c-r>' ) 94screen : expect { 95grid =[[ 96^ | 97{1:~ }|*3 98| 99]] , 100cmdline ={ { firstc =':' , content ={ { 'xx' } } , pos =2 , special ={ '"' , true } } } , 101} 102 103feed ( '=' ) 104screen : expect { 105grid =[[ 106^ | 107{1:~ }|*3 108| 109]] , 110cmdline ={ 111{ firstc =':' , content ={ { 'xx' } } , pos =2 , special ={ '"' , true } } , 112{ firstc ='=' , content ={ { '' } } , pos =0 } , 113} , 114} 115 116feed ( '1+2' ) 117 118screen : expect { 119grid =[[ 120^ | 121{1:~ }|*3 122| 123]] , 124cmdline ={ 125{ firstc =':' , content ={ { 'xx' } } , pos =2 , special ={ '"' , true } } , 126{ 127firstc ='=' , 128content ={ 129{ '1' , 26 , linegrid and 'NvimNumber' or nil } , 130{ '+' , 15 , linegrid and 'NvimBinaryPlus' or nil } , 131{ '2' , 26 , linegrid and 'NvimNumber' or nil } , 132} , 133pos =3 , 134} , 135} , 136} 137 138-- erase information, so we check if it is retransmitted 139command ( 'mode' ) 140screen : expect { 141grid =[[ 142^ | 143{1:~ }|*3 144| 145]] , 146cmdline ={ 147{ firstc =':' , content ={ { 'xx' } } , pos =2 , special ={ '"' , true } } , 148{ 149firstc ='=' , 150content ={ 151{ '1' , 26 , linegrid and 'NvimNumber' or nil } , 152{ '+' , 15 , linegrid and 'NvimBinaryPlus' or nil } , 153{ '2' , 26 , linegrid and 'NvimNumber' or nil } , 154} , 155pos =3 , 156} , 157} , 158reset =true , 159} 160 161feed ( '<cr>' ) 162screen : expect { 163grid =[[ 164^ | 165{1:~ }|*3 166| 167]] , 168cmdline ={ { firstc =':' , content ={ { 'xx3' } } , pos =3 } } , 169} 170 171feed ( '<esc>' ) 172screen : expect { 173grid =[[ 174^ | 175{1:~ }|*3 176| 177]] , 178cmdline ={ { abort =true } } , 179} 180end ) 181 182it ( 'works with function definitions' , function () 183feed ( ':function Foo()<cr>' ) 184screen : expect { 185grid =[[ 186^ | 187{1:~ }|*3 188| 189]] , 190cmdline ={ { indent =2 , firstc =':' , content ={ { '' } } , pos =0 } } , 191cmdline_block ={ { { 'function Foo()' } } } , 192} 193 194feed ( 'line1<cr>' ) 195screen : expect { 196grid =[[ 197^ | 198{1:~ }|*3 199| 200]] , 201cmdline ={ { indent =2 , firstc =':' , content ={ { '' } } , pos =0 } } , 202cmdline_block ={ { { 'function Foo()' } } , { { ' line1' } } } , 203} 204 205command ( 'mode' ) 206screen : expect { 207grid =[[ 208^ | 209{1:~ }|*3 210| 211]] , 212cmdline ={ { indent =2 , firstc =':' , content ={ { '' } } , pos =0 } } , 213cmdline_block ={ { { 'function Foo()' } } , { { ' line1' } } } , 214reset =true , 215} 216 217feed ( 'endfunction<cr>' ) 218screen : expect ( [[ 219^ | 220{1:~ }|*3 221| 222]] ) 223 224-- Try once more, to check buffer is reinitialized. #8007 225feed ( ':function Bar()<cr>' ) 226screen : expect { 227grid =[[ 228^ | 229{1:~ }|*3 230| 231]] , 232cmdline ={ { indent =2 , firstc =':' , content ={ { '' } } , pos =0 } } , 233cmdline_block ={ { { 'function Bar()' } } } , 234} 235 236feed ( 'endfunction<cr>' ) 237screen : expect ( [[ 238^ | 239{1:~ }|*3 240| 241]] ) 242end ) 243 244it ( 'with cmdwin' , function () 245feed ( ':make' ) 246screen : expect { 247grid =[[ 248^ | 249{1:~ }|*3 250| 251]] , 252cmdline ={ { firstc =':' , content ={ { 'make' } } , pos =4 } } , 253} 254 255feed ( '<c-f>' ) 256screen : expect ( [[ 257| 258{2:[No Name] }| 259{1::}mak^e | 260{3:[Command Line] }| 261| 262]] ) 263 264-- cmdwin is a plain window so `:yank` opens a top-level cmdline. No nesting allowed. #40312 265feed ( ':yank' ) 266screen : expect { 267grid =[[ 268| 269{2:[No Name] }| 270{1::}mak^e | 271{3:[Command Line] }| 272| 273]] , 274cmdline ={ { firstc =':' , content ={ { 'yank' } } , pos =4 } } , 275} 276 277command ( 'mode' ) 278screen : expect { 279grid =[[ 280| 281{2:[No Name] }| 282{1::}mak^e | 283{3:[Command Line] }| 284| 285]] , 286cmdline ={ { firstc =':' , content ={ { 'yank' } } , pos =4 } } , 287reset =true , 288} 289 290feed ( '<c-c>' ) 291screen : expect { 292grid =[[ 293| 294{2:[No Name] }| 295{1::}mak^e | 296{3:[Command Line] }| 297| 298]] , 299cmdline ={ { abort =true } } , 300} 301 302feed ( '<c-c>' ) 303screen : expect { 304grid =[[ 305^ | 306{1:~ }|*3 307| 308]] , 309cmdline ={ { firstc =':' , content ={ { 'make' } } , pos =4 } } , 310} 311end ) 312 313it ( 'works with inputsecret()' , function () 314feed ( ":call inputsecret('secret:')<cr>abc123" ) 315screen : expect { 316grid =[[ 317^ | 318{1:~ }|*3 319| 320]] , 321cmdline ={ { prompt ='secret:' , content ={ { '******' } } , pos =6 } } , 322} 323end ) 324 325it ( 'works with highlighted cmdline' , function () 326source ( [[ 327highlight RBP1 guibg=Red 328highlight RBP2 guibg=Yellow 329highlight RBP3 guibg=Green 330highlight RBP4 guibg=Blue 331let g:NUM_LVLS = 4 332function RainBowParens(cmdline) 333let ret = [] 334let i = 0 335let lvl = 0 336while i < len(a:cmdline) 337if a:cmdline[i] is# '(' 338call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)]) 339let lvl += 1 340elseif a:cmdline[i] is# ')' 341let lvl -= 1 342call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)]) 343endif 344let i += 1 345endwhile 346return ret 347endfunction 348map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr> 349"map <f5> :let x = input({'prompt':'>'})<cr> 350]] ) 351feed ( '<f5>(a(b)a)' ) 352screen : expect { 353grid =[[ 354^ | 355{1:~ }|*3 356| 357]] , 358cmdline ={ 359{ 360prompt ='>' , 361content ={ 362{ '(' , 30 , linegrid and 'RBP1' or nil } , 363{ 'a' } , 364{ '(' , 10 , linegrid and 'RBP2' or nil } , 365{ 'b' } , 366{ ')' , 10 , linegrid and 'RBP2' or nil } , 367{ 'a' } , 368{ ')' , 30 , linegrid and 'RBP1' or nil } , 369} , 370pos =7 , 371} , 372} , 373} 374end ) 375 376it ( 'works together with ext_wildmenu' , function () 377command ( 'set wildmode=full' ) 378command ( 'set wildmenu' ) 379screen : set_option ( 'ext_wildmenu' , true ) 380feed ( ':sign <tab>' ) 381 382screen : expect { 383grid =[[ 384^ | 385{1:~ }|*3 386| 387]] , 388cmdline ={ { firstc =':' , content ={ { 'sign define' } } , pos =11 } } , 389wildmenu_items ={ 'define' , 'jump' , 'list' , 'place' , 'undefine' , 'unplace' } , 390wildmenu_pos =0 , 391} 392 393feed ( '<tab>' ) 394screen : expect { 395grid =[[ 396^ | 397{1:~ }|*3 398| 399]] , 400cmdline ={ { firstc =':' , content ={ { 'sign jump' } } , pos =9 } } , 401wildmenu_items ={ 'define' , 'jump' , 'list' , 'place' , 'undefine' , 'unplace' } , 402wildmenu_pos =1 , 403} 404 405feed ( '<left><left>' ) 406screen : expect { 407grid =[[ 408^ | 409{1:~ }|*3 410| 411]] , 412cmdline ={ { firstc =':' , content ={ { 'sign ' } } , pos =5 } } , 413wildmenu_items ={ 'define' , 'jump' , 'list' , 'place' , 'undefine' , 'unplace' } , 414wildmenu_pos =- 1 , 415} 416 417feed ( '<right>' ) 418screen : expect { 419grid =[[ 420^ | 421{1:~ }|*3 422| 423]] , 424cmdline ={ { firstc =':' , content ={ { 'sign define' } } , pos =11 } } , 425wildmenu_items ={ 'define' , 'jump' , 'list' , 'place' , 'undefine' , 'unplace' } , 426wildmenu_pos =0 , 427} 428 429feed ( 'a' ) 430screen : expect { 431grid =[[ 432^ | 433{1:~ }|*3 434| 435]] , 436cmdline ={ { firstc =':' , content ={ { 'sign definea' } } , pos =12 } } , 437} 438end ) 439 440local function test_ext_cmdline_popupmenu () 441local expected ={ 442{ 'define' , '' , '' , '' } , 443{ 'jump' , '' , '' , '' } , 444{ 'list' , '' , '' , '' } , 445{ 'place' , '' , '' , '' } , 446{ 'undefine' , '' , '' , '' } , 447{ 'unplace' , '' , '' , '' } , 448} 449 450command ( 'set wildmode=full' ) 451command ( 'set wildmenu' ) 452screen : set_option ( 'ext_popupmenu' , true ) 453feed ( ':sign <tab>' ) 454 455screen : expect { 456grid =[[ 457^ | 458{1:~ }|*3 459| 460]] , 461cmdline ={ { firstc =':' , content ={ { 'sign define' } } , pos =11 } } , 462popupmenu ={ items =expected , pos =0 , anchor ={ - 1 , 0 , 5 } } , 463} 464 465feed ( '<tab>' ) 466screen : expect { 467grid =[[ 468^ | 469{1:~ }|*3 470| 471]] , 472cmdline ={ { firstc =':' , content ={ { 'sign jump' } } , pos =9 } } , 473popupmenu ={ items =expected , pos =1 , anchor ={ - 1 , 0 , 5 } } , 474} 475 476feed ( '<left><left>' ) 477screen : expect { 478grid =[[ 479^ | 480{1:~ }|*3 481| 482]] , 483cmdline ={ { firstc =':' , content ={ { 'sign ' } } , pos =5 } } , 484popupmenu ={ items =expected , pos =- 1 , anchor ={ - 1 , 0 , 5 } } , 485} 486 487feed ( '<right>' ) 488screen : expect { 489grid =[[ 490^ | 491{1:~ }|*3 492| 493]] , 494cmdline ={ { firstc =':' , content ={ { 'sign define' } } , pos =11 } } , 495popupmenu ={ items =expected , pos =0 , anchor ={ - 1 , 0 , 5 } } , 496} 497 498feed ( 'a' ) 499screen : expect { 500grid =[[ 501^ | 502{1:~ }|*3 503| 504]] , 505cmdline ={ { firstc =':' , content ={ { 'sign definea' } } , pos =12 } } , 506} 507feed ( '<esc>' ) 508 509-- check positioning with multibyte char in pattern 510command ( 'e långfile1' ) 511command ( 'sp långfile2' ) 512feed ( ':b lå<tab>' ) 513screen : expect { 514grid =[[ 515^ | 516{3:långfile2 }| 517| 518{2:långfile1 }| 519| 520]] , 521cmdline ={ { content ={ { 'b långfile1' } } , firstc =':' , pos =12 } } , 522popupmenu ={ 523anchor ={ - 1 , 0 , 2 } , 524items ={ { 'långfile1' , '' , '' , '' } , { 'långfile2' , '' , '' , '' } } , 525pos =0 , 526} , 527} 528 529feed ( '<Esc>' ) 530command ( 'silent %bwipe' ) 531 532command ( 'set shellslash' ) 533-- position is correct when expanding environment variable #20348 534command ( 'silent cd test/functional/fixtures' ) 535n . fn . setenv ( 'XNDIR' , 'wildpum/Xnamedir' ) 536feed ( ':e $XNDIR/<Tab>' ) 537screen : expect { 538grid =[[ 539^ | 540{1:~ }|*3 541| 542]] , 543cmdline ={ { content ={ { 'e wildpum/Xnamedir/XdirA/' } } , firstc =':' , pos =25 } } , 544popupmenu ={ 545anchor ={ - 1 , 0 , 19 } , 546items ={ { 'XdirA/' , '' , '' , '' } , { 'XfileA' , '' , '' , '' } } , 547pos =0 , 548} , 549} 550 551feed ( '<Esc>' ) 552command ( 'set wildmode=longest,full' ) 553feed ( ':sign u<tab>' ) 554screen : expect { 555grid =[[ 556^ | 557{1:~ }|*3 558| 559]] , 560cmdline ={ { content ={ { 'sign un' } } , firstc =':' , pos =7 } } , 561} 562 563feed ( '<tab>' ) 564local s_undefine_unplace_0 ={ 565grid =[[ 566^ | 567{1:~ }|*3 568| 569]] , 570cmdline ={ { content ={ { 'sign undefine' } } , firstc =':' , pos =13 } } , 571popupmenu ={ 572anchor ={ - 1 , 0 , 5 } , 573items ={ { 'undefine' , '' , '' , '' } , { 'unplace' , '' , '' , '' } } , 574pos =0 , 575} , 576} 577screen : expect ( s_undefine_unplace_0 ) 578 579feed ( '<Esc>' ) 580screen : expect ( [[ 581^ | 582{1:~ }|*3 583| 584]] ) 585 586feed ( ':sign un<tab>' ) 587screen : expect ( s_undefine_unplace_0 ) 588end 589 590describe ( 'works together with ext_popupmenu' , function () 591it ( 'with wildoptions=pum' , function () 592command ( 'set wildoptions=pum' ) 593test_ext_cmdline_popupmenu () 594end ) 595 596it ( 'with wildoptions=' , function () 597command ( 'set wildoptions=' ) 598test_ext_cmdline_popupmenu () 599end ) 600end ) 601 602it ( 'ext_wildmenu takes precedence over ext_popupmenu' , function () 603local expected ={ 604'define' , 605'jump' , 606'list' , 607'place' , 608'undefine' , 609'unplace' , 610} 611 612command ( 'set wildmode=full' ) 613command ( 'set wildmenu' ) 614screen : set_option ( 'ext_wildmenu' , true ) 615screen : set_option ( 'ext_popupmenu' , true ) 616feed ( ':sign <tab>' ) 617 618screen : expect { 619grid =[[ 620^ | 621{1:~ }|*3 622| 623]] , 624cmdline ={ { firstc =':' , content ={ { 'sign define' } } , pos =11 } } , 625wildmenu_items =expected , 626wildmenu_pos =0 , 627} 628end ) 629 630it ( "doesn't send invalid events when aborting mapping #10000" , function () 631command ( 'set notimeout' ) 632command ( 'cnoremap ab c' ) 633 634feed ( ':xa' ) 635screen : expect { 636grid =[[ 637^ | 638{1:~ }|*3 639| 640]] , 641cmdline ={ { content ={ { 'x' } } , firstc =':' , pos =1 , special ={ 'a' , false } } } , 642} 643 644-- This used to send an invalid event where pos where larger than the total 645-- length of content. Checked in _handle_cmdline_show. 646feed ( '<esc>' ) 647screen : expect ( { 648grid =[[ 649^ | 650{1:~ }|*3 651| 652]] , 653cmdline ={ { abort =true } } , 654} ) 655end ) 656 657it ( 'does not move cursor to curwin #20309' , function () 658local win =api . nvim_get_current_win () 659command ( 'norm icmdlinewin' ) 660command ( 'new' ) 661command ( 'norm icurwin' ) 662feed ( ':' ) 663api . nvim_win_set_cursor ( win , { 1 , 7 } ) 664api . nvim__redraw ( { win =win , cursor =true } ) 665screen : expect { 666grid =[[ 667curwin | 668{3:[No Name] [+] }| 669cmdline^win | 670{2:[No Name] [+] }| 671| 672]] , 673cmdline ={ { content ={ { '' } } , firstc =':' , pos =0 } } , 674} 675end ) 676 677it ( 'show prompt hl_id' , function () 678screen : expect ( [[ 679^ | 680{1:~ }|*3 681| 682]] ) 683feed ( ':echohl Error | call input("Prompt:")<CR>' ) 684screen : expect ( { 685grid =[[ 686^ | 687{1:~ }|*3 688| 689]] , 690cmdline ={ { content ={ { '' } } , hl ='Error' , pos =0 , prompt ='Prompt:' } } , 691} ) 692end ) 693 694it ( 'works with conditionals' , function () 695screen : expect ( [[ 696^ | 697{1:~ }|*3 698| 699]] ) 700feed ( ':if 1<CR>' ) 701screen : expect ( { 702grid =[[ 703^ | 704{1:~ }|*3 705| 706]] , 707cmdline ={ { content ={ { '' } } , firstc =':' , indent =2 , pos =0 } } , 708cmdline_block ={ { { 'if 1' } } } , 709} ) 710feed ( 'let x = 1<CR>' ) 711screen : expect ( { 712grid =[[ 713^ | 714{1:~ }|*3 715| 716]] , 717cmdline ={ { content ={ { '' } } , firstc =':' , indent =2 , pos =0 } } , 718cmdline_block ={ { { 'if 1' } } , { { ' let x = 1' } } } , 719} ) 720feed ( '<CR>' ) 721eq ( 'let x = 1' , eval ( '@:' )) 722screen : expect ( { 723grid =[[ 724^ | 725{1:~ }|*3 726| 727]] , 728cmdline ={ { content ={ { '' } } , firstc =':' , indent =2 , pos =0 } } , 729cmdline_block ={ { { 'if 1' } } , { { ' let x = 1' } } , { { ' ' } } } , 730} ) 731feed ( 'call input("foo:")<CR>' ) 732screen : expect ( { 733grid =[[ 734^ | 735{1:~ }|*3 736| 737]] , 738cmdline ={ { content ={ { '' } } , pos =0 , prompt ='foo:' } } , 739cmdline_block ={ 740{ { 'if 1' } } , 741{ { ' let x = 1' } } , 742{ { ' ' } } , 743{ { ' call input("foo:")' } } , 744} , 745} ) 746feed ( 'bar<CR>' ) 747screen : expect ( { 748grid =[[ 749^ | 750{1:~ }|*3 751| 752]] , 753cmdline ={ { content ={ { '' } } , firstc =':' , indent =2 , pos =0 } } , 754cmdline_block ={ 755{ { 'if 1' } } , 756{ { ' let x = 1' } } , 757{ { ' ' } } , 758{ { ' call input("foo:")' } } , 759} , 760} ) 761feed ( 'endif' ) 762screen : expect ( { 763grid =[[ 764^ | 765{1:~ }|*3 766| 767]] , 768cmdline ={ { content ={ { 'endif' } } , firstc =':' , indent =2 , pos =5 } } , 769cmdline_block ={ 770{ { 'if 1' } } , 771{ { ' let x = 1' } } , 772{ { ' ' } } , 773{ { ' call input("foo:")' } } , 774} , 775} ) 776feed ( '<CR>' ) 777screen : expect ( [[ 778^ | 779{1:~ }|*3 780| 781]] ) 782end ) 783 784it ( 'works with exmode' , function () 785screen : try_resize ( 60 , 12 ) 786feed ( '1q:' ) 787screen : expect ( [[ 788| 789{1:~ }| 790{2:[No Name] }| 791{1::}^ | 792{1:~ }|*6 793{3:[Ex mode] }| 794{5:-- INSERT --} | 795]] ) 796feed ( 'echo "foo"<CR>' ) 797screen : expect ( [[ 798| 799{1:~ }| 800{2:[No Name] }| 801{1::}echo "foo" | 802{1::}" foo | 803{1::}^ | 804{1:~ }|*4 805{3:[Ex mode] }| 806{5:-- INSERT --} | 807]] ) 808feed ( '<C-\\><C-N>vis<CR>' ) 809screen : expect ( [[ 810^ | 811{1:~ }|*10 812| 813]] ) 814assert_alive () 815end ) 816 817it ( 'works with :lua debug.debug()' , function () 818feed ( ':lua debug.debug()<CR>' ) 819screen : expect ( { 820grid =[[ 821^ | 822{1:~ }|*3 823| 824]] , 825cmdline ={ { content ={ { '' } } , pos =0 , prompt ='lua_debug> ' } } , 826} ) 827feed ( 'print("foo")<CR>' ) 828screen : expect ( { 829grid =[[ 830| 831{1:~ }|*3 832foo^ | 833]] , 834cmdline ={ { content ={ { '' } } , pos =0 , prompt ='lua_debug> ' } } , 835cmdline_block ={ { { 'lua_debug> print("foo")' } } } , 836} ) 837feed ( '<Esc>' ) 838screen : expect ( { 839grid =[[ 840^ | 841{1:~ }|*3 842| 843]] , 844cmdline ={ { abort =true } } , 845} ) 846end ) 847end 848 849-- the representation of cmdline and cmdline_block contents changed with ext_linegrid 850-- (which uses indexed highlights) so make sure to test both 851describe ( 'ui/ext_cmdline' , function () 852test_cmdline ( true ) 853end ) 854describe ( 'ui/ext_cmdline (legacy highlights)' , function () 855test_cmdline ( false ) 856end ) 857 858describe ( 'cmdline redraw' , function () 859local screen 860before_each ( function () 861clear () 862screen =Screen . new ( 25 , 5 , { rgb =true } ) 863end ) 864 865it ( 'with timer' , function () 866feed ( ':012345678901234567890123456789' ) 867screen : expect ( [[ 868| 869{1:~ }| 870{3: }| 871:012345678901234567890123| 872456789^ | 873]] ) 874command ( 'call timer_start(0, {-> 1})' ) 875screen : expect_unchanged () 876end ) 877 878it ( 'with <Cmd>' , function () 879if is_os ( 'bsd' ) then 880pending ( 'FIXME #10804' ) 881end 882command ( 'cmap a <Cmd>call sin(0)<CR>' ) -- no-op 883feed ( ':012345678901234567890123456789' ) 884screen : expect ( [[ 885| 886{1:~ }| 887{3: }| 888:012345678901234567890123| 889456789^ | 890]] ) 891feed ( 'a' ) 892screen : expect_unchanged () 893end ) 894 895it ( 'after pressing Ctrl-C in cmdwin in Visual mode #18967' , function () 896screen : try_resize ( 40 , 10 ) 897command ( 'set cmdwinheight=3' ) 898feed ( 'q:iabc<Esc>vhh' ) 899screen : expect ( [[ 900| 901{1:~ }|*3 902{2:[No Name] }| 903{1::}{17:^abc} | 904{1:~ }|*2 905{3:[Command Line] }| 906{5:-- VISUAL --} | 907]] ) 908-- Ctrl-C closes cmdwin and drops back into pre-filled cmdline. #40312 909feed ( '<C-C>' ) 910screen : expect ( [[ 911| 912{1:~ }|*8 913:abc^ | 914]] ) 915end ) 916 917it ( 'with rightleftcmd' , function () 918command ( 'set rightleft rightleftcmd=search shortmess+=s' ) 919api . nvim_buf_set_lines ( 0 , 0 , - 1 , true , { "let's rock!" } ) 920screen : expect ( [[ 921!kcor s'te^l| 922{1: ~}|*3 923| 924]] ) 925 926feed '/' 927screen : expect ( [[ 928!kcor s'tel| 929{1: ~}|*3 930^ /| 931]] ) 932 933feed "let's" 934-- note: cursor looks off but looks alright in real use 935-- when rendered as a block so it touches the end of the text 936screen : expect ( [[ 937!kcor {2:s'tel}| 938{1: ~}|*3 939^ s'tel/| 940]] ) 941 942-- cursor movement 943feed '<space>' 944screen : expect ( [[ 945!kcor{2: s'tel}| 946{1: ~}|*3 947^ s'tel/| 948]] ) 949 950feed 'rock' 951screen : expect ( [[ 952!{2:kcor s'tel}| 953{1: ~}|*3 954^ kcor s'tel/| 955]] ) 956 957feed '<right>' 958screen : expect ( [[ 959!{2:kcor s'tel}| 960{1: ~}|*3 961^kcor s'tel/| 962]] ) 963 964feed '<left>' 965screen : expect ( [[ 966!{2:kcor s'tel}| 967{1: ~}|*3 968^ kcor s'tel/| 969]] ) 970 971feed '<cr>' 972screen : expect ( [[ 973!{10:kcor s'te^l}| 974{1: ~}|*3 975kcor s'tel/ | 976]] ) 977end ) 978 979it ( 'prompt with silent mapping and screen update' , function () 980command ( [[nmap <silent> T :call confirm("Save changes?", "&Yes\n&No\n&Cancel")<CR>]] ) 981feed ( 'T' ) 982screen : expect ( [[ 983| 984{3: }| 985| 986{6:Save changes?} | 987{6:[Y]es, (N)o, (C)ancel: }^ | 988]] ) 989command ( 'call setline(1, "foo") | redraw' ) 990screen : expect ( [[ 991foo | 992{3: }| 993| 994{6:Save changes?} | 995{6:[Y]es, (N)o, (C)ancel: }^ | 996]] ) 997feed ( 'Y' ) 998screen : expect ( [[ 999^foo | 1000{1:~ }|*3 1001| 1002]] ) 1003screen : try_resize ( 75 , screen . _height ) 1004feed ( ':call inputlist(["foo", "bar"])<CR>' ) 1005screen : expect ( [[ 1006foo | 1007{3: }| 1008foo | 1009bar | 1010Type number and <Enter> (q or empty cancels): ^ | 1011]] ) 1012command ( 'redraw' ) 1013screen : expect_unchanged () 1014 1015command ( 'set keymap=dvorak' ) 1016feed ( '<C-^>' ) 1017command ( 'redraw' ) 1018screen : expect_unchanged () 1019 1020feed ( '<C-^>' ) 1021command ( 'set keymap&' ) 1022command ( 'redraw' ) 1023screen : expect_unchanged () 1024end ) 1025 1026it ( 'substitute confirm prompt does not scroll' , function () 1027screen : try_resize ( 75 , screen . _height ) 1028command ( 'call setline(1, "foo")' ) 1029command ( 'set report=0' ) 1030feed ( ':%s/foo/bar/c<CR>' ) 1031screen : expect ( [[ 1032{2:foo} | 1033{1:~ }|*3 1034{6:replace with bar? (y)es/(n)o/(a)ll/(q)uit/(l)ast/scroll up(^E)/down(^Y)}^ | 1035]] ) 1036feed ( 'y' ) 1037screen : expect ( [[ 1038^bar | 1039{1:~ }|*3 10401 substitution on 1 line | 1041]] ) 1042end ) 1043 1044it ( 'no empty cmdline after empty echo #18274' , function () 1045feed ( ':foo' ) 1046api . nvim_echo ( { { '' } } , false , {} ) 1047screen : expect ( [[ 1048| 1049{1:~ }|*3 1050:foo^ | 1051]] ) 1052feed (( 'o' ): rep ( screen . _width - 4 )) 1053-- No repeated cmdline redraws at screen width 1054screen : expect ( [[ 1055| 1056{1:~ }| 1057{3: }| 1058:fooooooooooooooooooooooo| 1059^ | 1060]] ) 1061command ( 'call timer_start(0, {-> 1})' ) 1062screen : expect_unchanged () 1063end ) 1064end ) 1065 1066describe ( 'statusline is redrawn on entering cmdline' , function () 1067local screen 1068 1069before_each ( function () 1070clear () 1071screen =Screen . new ( 25 , 5 ) 1072command ( 'set laststatus=2' ) 1073end ) 1074 1075it ( 'from normal mode' , function () 1076command ( 'set statusline=%{mode()}' ) 1077screen : expect ( [[ 1078^ | 1079{1:~ }|*2 1080{3:n }| 1081| 1082]] ) 1083 1084feed ( ':' ) 1085screen : expect ( [[ 1086| 1087{1:~ }|*2 1088{3:c }| 1089:^ | 1090]] ) 1091end ) 1092 1093it ( 'from normal mode when : is mapped' , function () 1094command ( 'set statusline=%{mode()}' ) 1095command ( 'nnoremap ; :' ) 1096 1097screen : expect ( [[ 1098^ | 1099{1:~ }|*2 1100{3:n }| 1101| 1102]] ) 1103 1104feed ( ';' ) 1105screen : expect ( [[ 1106| 1107{1:~ }|*2 1108{3:c }| 1109:^ | 1110]] ) 1111end ) 1112 1113it ( 'with scrolled messages' , function () 1114screen : try_resize ( 35 , 14 ) 1115exec ( [[ 1116let g:count = 0 1117autocmd CmdlineEnter * let g:count += 1 1118split 1119resize 1 1120setlocal statusline=%{mode()}%{g:count} 1121setlocal winbar=%{mode()}%{g:count} 1122]] ) 1123feed ( ':echoerr doesnotexist<cr>' ) 1124screen : expect ( [[ 1125{5:c1 }| 1126| 1127{3:c1 }| 1128| 1129{1:~ }|*5 1130{3: }| 1131{9:E121: Undefined variable: doesnotex}| 1132{9:ist} | 1133{6:Press ENTER or type command to cont}| 1134{6:inue}^ | 1135]] ) 1136feed ( ':echoerr doesnotexist<cr>' ) 1137screen : expect ( [[ 1138{5:c2 }| 1139| 1140{3:c2 }| 1141| 1142{1:~ }|*2 1143{3: }| 1144{9:E121: Undefined variable: doesnotex}| 1145{9:ist} | 1146{6:Press ENTER or type command to cont}| 1147{9:E121: Undefined variable: doesnotex}| 1148{9:ist} | 1149{6:Press ENTER or type command to cont}| 1150{6:inue}^ | 1151]] ) 1152 1153feed ( ':echoerr doesnotexist<cr>' ) 1154screen : expect ( [[ 1155{5:c3 }| 1156| 1157{3:c3 }| 1158{3: }| 1159{9:E121: Undefined variable: doesnotex}| 1160{9:ist} | 1161{6:Press ENTER or type command to cont}| 1162{9:E121: Undefined variable: doesnotex}| 1163{9:ist} | 1164{6:Press ENTER or type command to cont}| 1165{9:E121: Undefined variable: doesnotex}| 1166{9:ist} | 1167{6:Press ENTER or type command to cont}| 1168{6:inue}^ | 1169]] ) 1170 1171feed ( '<cr>' ) 1172screen : expect ( [[ 1173{5:n3 }| 1174^ | 1175{3:n3 }| 1176| 1177{1:~ }|*8 1178{2:[No Name] }| 1179| 1180]] ) 1181end ) 1182 1183describe ( 'if custom statusline is set by' , function () 1184before_each ( function () 1185command ( 'set statusline=' ) 1186screen : expect ( [[ 1187^ | 1188{1:~ }|*2 1189{3:[No Name] }| 1190| 1191]] ) 1192end ) 1193 1194it ( 'CmdlineEnter autocommand' , function () 1195command ( 'autocmd CmdlineEnter * set statusline=command' ) 1196feed ( ':' ) 1197screen : expect ( [[ 1198| 1199{1:~ }|*2 1200{3:command }| 1201:^ | 1202]] ) 1203end ) 1204 1205it ( 'ModeChanged autocommand' , function () 1206command ( 'autocmd ModeChanged *:c set statusline=command' ) 1207feed ( ':' ) 1208screen : expect ( [[ 1209| 1210{1:~ }|*2 1211{3:command }| 1212:^ | 1213]] ) 1214end ) 1215end ) 1216end ) 1217 1218it ( 'tabline is not redrawn in Ex mode #24122' , function () 1219clear () 1220local screen =Screen . new ( 60 , 8 ) 1221 1222exec ( [[ 1223set showtabline=2 1224set tabline=%!MyTabLine() 1225 1226function! MyTabLine() 1227 1228return "foo" 1229endfunction 1230]] ) 1231 1232feed ( '1q:' ) 1233screen : expect ( [[ 1234{2:foo }| 1235| 1236{2:[No Name] }| 1237{1::}^ | 1238{1:~ }|*2 1239{3:[Ex mode] }| 1240{5:-- INSERT --} | 1241]] ) 1242feed ( 'echo 1<CR>' ) 1243screen : expect ( [[ 1244{2:foo }| 1245| 1246{2:[No Name] }| 1247{1::}echo 1 | 1248{1::}" 1 | 1249{1::}^ | 1250{3:[Ex mode] }| 1251{5:-- INSERT --} | 1252]] ) 1253end ) 1254 1255describe ( 'cmdline height' , function () 1256before_each ( clear ) 1257 1258it ( 'does not crash resized screen #14263' , function () 1259local screen =Screen . new ( 25 , 10 ) 1260command ( 'set cmdheight=9999' ) 1261screen : try_resize ( 25 , 5 ) 1262assert_alive () 1263end ) 1264 1265it ( 'unchanged when restoring window sizes with global statusline' , function () 1266command ( 'set cmdheight=2 laststatus=2' ) 1267feed ( 'q:' ) 1268command ( 'set cmdheight=1 laststatus=3 | quit' ) 1269-- Available lines changed, so closing cmdwin should skip restoring window sizes, leaving the 1270-- cmdheight unchanged. 1271eq ( 1 , eval ( '&cmdheight' )) 1272end ) 1273 1274it ( 'not increased to 0 from 1 with wincmd _' , function () 1275command ( 'set cmdheight=0 laststatus=0' ) 1276command ( 'wincmd _' ) 1277eq ( 0 , eval ( '&cmdheight' )) 1278end ) 1279end ) 1280 1281describe ( 'cmdheight=0' , function () 1282local screen 1283before_each ( function () 1284clear () 1285screen =Screen . new ( 25 , 5 ) 1286end ) 1287 1288it ( 'with redrawdebug=invalid resize -1' , function () 1289command ( 'set redrawdebug=invalid cmdheight=0 noruler laststatus=0' ) 1290screen : expect ( [[ 1291^ | 1292{1:~ }|*4 1293]] ) 1294feed ( ':resize -1<CR>' ) 1295screen : expect ( [[ 1296^ | 1297{1:~ }|*3 1298| 1299]] ) 1300assert_alive () 1301end ) 1302 1303it ( 'with cmdheight=1 noruler laststatus=2' , function () 1304command ( 'set cmdheight=1 noruler laststatus=2' ) 1305screen : expect ( [[ 1306^ | 1307{1:~ }|*2 1308{3:[No Name] }| 1309| 1310]] ) 1311end ) 1312 1313it ( 'with cmdheight=0 noruler laststatus=2' , function () 1314command ( 'set cmdheight=0 noruler laststatus=2' ) 1315screen : expect ( [[ 1316^ | 1317{1:~ }|*3 1318{3:[No Name] }| 1319]] ) 1320end ) 1321 1322it ( 'with cmdheight=0 ruler laststatus=0' , function () 1323command ( 'set cmdheight=0 ruler laststatus=0' ) 1324screen : expect ( [[ 1325^ | 1326{1:~ }|*4 1327]] ) 1328end ) 1329 1330it ( 'with cmdheight=0 ruler laststatus=0' , function () 1331command ( 'set cmdheight=0 noruler laststatus=0 showmode' ) 1332feed ( 'i' ) 1333screen : expect { 1334grid =[[ 1335^ | 1336{1:~ }|*4 1337]] , 1338showmode ={} , 1339} 1340feed ( '<Esc>' ) 1341eq ( 0 , eval ( '&cmdheight' )) 1342end ) 1343 1344it ( 'with cmdheight=0 ruler rulerformat laststatus=0' , function () 1345command ( 'set cmdheight=0 noruler laststatus=0 rulerformat=%l,%c%= showmode' ) 1346feed ( 'i' ) 1347screen : expect { 1348grid =[[ 1349^ | 1350{1:~ }|*4 1351]] , 1352showmode ={} , 1353} 1354feed ( '<Esc>' ) 1355eq ( 0 , eval ( '&cmdheight' )) 1356end ) 1357 1358it ( 'with showmode' , function () 1359command ( 'set cmdheight=1 noruler laststatus=0 showmode' ) 1360feed ( 'i' ) 1361screen : expect ( [[ 1362^ | 1363{1:~ }|*3 1364{5:-- INSERT --} | 1365]] ) 1366feed ( '<Esc>' ) 1367eq ( 1 , eval ( '&cmdheight' )) 1368end ) 1369 1370it ( 'when using command line' , function () 1371command ( 'set cmdheight=0 noruler laststatus=0' ) 1372feed ( ':' ) 1373screen : expect ( [[ 1374| 1375{1:~ }|*3 1376:^ | 1377]] ) 1378eq ( 0 , eval ( '&cmdheight' )) 1379feed ( '<cr>' ) 1380screen : expect { 1381grid =[[ 1382^ | 1383{1:~ }|*4 1384]] , 1385showmode ={} , 1386} 1387eq ( 0 , eval ( '&cmdheight' )) 1388end ) 1389 1390it ( 'when using input()' , function () 1391command ( 'set cmdheight=0 noruler laststatus=0' ) 1392feed ( ':call input("foo >")<cr>' ) 1393screen : expect ( [[ 1394| 1395{1:~ }| 1396{3: }| 1397:call input("foo >") | 1398foo >^ | 1399]] ) 1400eq ( 0 , eval ( '&cmdheight' )) 1401feed ( '<cr>' ) 1402screen : expect { 1403grid =[[ 1404^ | 1405{1:~ }|*4 1406]] , 1407showmode ={} , 1408} 1409eq ( 0 , eval ( '&cmdheight' )) 1410end ) 1411 1412it ( 'with winbar and splits' , function () 1413command ( 'set cmdheight=0 noruler laststatus=3 winbar=foo' ) 1414feed ( ':split<CR>' ) 1415screen : expect ( [[ 1416{3: }| 1417:split | 1418{9:E36: Not enough room} | 1419{6:Press ENTER or type comma}| 1420{6:nd to continue}^ | 1421]] ) 1422feed ( '<CR>' ) 1423screen : expect ( [[ 1424{5:foo }| 1425^ | 1426{1:~ }|*2 1427{3:[No Name] }| 1428]] ) 1429feed ( ':' ) 1430screen : expect ( [[ 1431{5:foo }| 1432| 1433{1:~ }|*2 1434:^ | 1435]] ) 1436feed ( '<Esc>' ) 1437screen : expect { 1438grid =[[ 1439{5:foo }| 1440^ | 1441{1:~ }|*2 1442{3:[No Name] }| 1443]] , 1444showmode ={} , 1445} 1446eq ( 0 , eval ( '&cmdheight' )) 1447 1448assert_alive () 1449end ) 1450 1451it ( 'when macro with lastline' , function () 1452command ( 'set cmdheight=0 display=lastline' ) 1453feed ( 'qq' ) 1454screen : expect ( [[ 1455^ | 1456{1:~ }|*4 1457]] ) 1458feed ( 'q' ) 1459screen : expect { 1460grid =[[ 1461^ | 1462{1:~ }|*4 1463]] , 1464unchanged =true , 1465} 1466end ) 1467 1468it ( 'when substitute text' , function () 1469command ( 'set cmdheight=0 noruler laststatus=3' ) 1470feed ( 'ifoo<ESC>' ) 1471screen : try_resize ( screen . _width , 7 ) 1472screen : expect ( [[ 1473fo^o | 1474{1:~ }|*5 1475{3:[No Name] [+] }| 1476]] ) 1477 1478feed ( ':%s/foo/bar/gc<CR>' ) 1479screen : expect ( [[ 1480{2:foo} | 1481{3: }| 1482|*2 1483{6:replace with bar? (y)es/(}| 1484{6:n)o/(a)ll/(q)uit/(l)ast/s}| 1485{6:croll up(^E)/down(^Y)}^ | 1486]] ) 1487 1488feed ( 'y' ) 1489screen : expect ( [[ 1490^bar | 1491{1:~ }|*5 1492{3:[No Name] [+] }| 1493]] ) 1494 1495assert_alive () 1496end ) 1497 1498it ( 'when window resize' , function () 1499command ( 'set cmdheight=0' ) 1500feed ( '<C-w>+' ) 1501eq ( 0 , eval ( '&cmdheight' )) 1502end ) 1503 1504it ( 'with non-silent mappings with cmdline' , function () 1505command ( 'set cmdheight=0' ) 1506command ( 'map <f3> :nohlsearch<cr>' ) 1507feed ( 'iaabbaa<esc>/aa<cr>' ) 1508screen : expect ( [[ 1509{10:^aa}bb{10:aa} | 1510{1:~ }|*4 1511]] ) 1512 1513feed ( '<f3>' ) 1514screen : expect ( [[ 1515^aabbaa | 1516{1:~ }|*4 1517]] ) 1518end ) 1519 1520it ( 'with silent! at startup' , function () 1521clear { args ={ '-c' , 'set cmdheight=0' , '-c' , 'autocmd VimEnter * silent! call Foo()' } } 1522screen =Screen . new ( 25 , 5 ) 1523-- doesn't crash while not displaying silent! error message 1524screen : expect ( [[ 1525^ | 1526{1:~ }|*4 1527]] ) 1528end ) 1529 1530it ( 'with multigrid' , function () 1531clear { args ={ '--cmd' , 'set cmdheight=0' } } 1532screen =Screen . new ( 25 , 5 , { ext_multigrid =true } ) 1533api . nvim_buf_set_lines ( 0 , 0 , - 1 , true , { 'p' } ) 1534screen : expect { 1535grid =[[ 1536## grid 1 1537[2:-------------------------]|*5 1538## grid 2 1539^p | 1540{1:~ }|*4 1541## grid 3 1542]] , 1543win_viewport ={ 1544[ 2 ] ={ 1545win =1000 , 1546topline =0 , 1547botline =2 , 1548curline =0 , 1549curcol =0 , 1550linecount =1 , 1551sum_scroll_delta =0 , 1552} , 1553} , 1554} 1555 1556feed '/p' 1557screen : expect { 1558grid =[[ 1559## grid 1 1560[2:-------------------------]|*4 1561[3:-------------------------]| 1562## grid 2 1563{2:p} | 1564{1:~ }|*4 1565## grid 3 1566/p^ | 1567]] , 1568win_viewport ={ 1569[ 2 ] ={ 1570win =1000 , 1571topline =0 , 1572botline =2 , 1573curline =0 , 1574curcol =1 , 1575linecount =1 , 1576sum_scroll_delta =0 , 1577} , 1578} , 1579} 1580end ) 1581 1582it ( 'winbar is redrawn on entering cmdline and :redrawstatus #20336' , function () 1583exec ( [[ 1584set cmdheight=0 1585set winbar=%{mode()}%=:%{getcmdline()} 1586]] ) 1587feed ( ':' ) 1588screen : expect ( [[ 1589{5:c :}| 1590| 1591{1:~ }|*2 1592:^ | 1593]] ) 1594feed ( 'echo' ) 1595-- not redrawn yet 1596screen : expect ( [[ 1597{5:c :}| 1598| 1599{1:~ }|*2 1600:echo^ | 1601]] ) 1602command ( 'redrawstatus' ) 1603screen : expect ( [[ 1604{5:c :echo}| 1605| 1606{1:~ }|*2 1607:echo^ | 1608]] ) 1609end ) 1610 1611it ( 'window equalization with laststatus=0 #20367' , function () 1612screen : try_resize ( 60 , 9 ) 1613command ( 'set cmdheight=0 laststatus=0' ) 1614command ( 'vsplit' ) 1615screen : expect ( [[ 1616^ │ | 1617{1:~ }│{1:~ }|*8 1618]] ) 1619feed ( ':' ) 1620command ( 'split' ) 1621feed ( '<Esc>' ) 1622screen : expect ( [[ 1623^ │ | 1624{1:~ }│{1:~ }|*3 1625{3:[No Name] }│{1:~ }| 1626│{1:~ }| 1627{1:~ }│{1:~ }|*3 1628]] ) 1629command ( 'resize 2' ) 1630screen : expect ( [[ 1631^ │ | 1632{1:~ }│{1:~ }| 1633{3:[No Name] }│{1:~ }| 1634│{1:~ }| 1635{1:~ }│{1:~ }|*5 1636]] ) 1637feed ( ':' ) 1638command ( 'wincmd =' ) 1639feed ( '<Esc>' ) 1640screen : expect ( [[ 1641^ │ | 1642{1:~ }│{1:~ }|*3 1643{3:[No Name] }│{1:~ }| 1644│{1:~ }| 1645{1:~ }│{1:~ }|*3 1646]] ) 1647end ) 1648 1649it ( 'no assert failure with showcmd' , function () 1650command ( 'set showcmd cmdheight=0' ) 1651feed ( 'd' ) 1652screen : expect ( [[ 1653^ | 1654{1:~ }|*4 1655]] ) 1656assert_alive () 1657end ) 1658 1659it ( 'can only be resized to 0 if set explicitly' , function () 1660command ( 'set laststatus=2' ) 1661command ( 'resize +1' ) 1662screen : expect ( [[ 1663^ | 1664{1:~ }|*2 1665{3:[No Name] }| 1666| 1667]] ) 1668command ( 'set cmdheight=0' ) 1669screen : expect ( [[ 1670^ | 1671{1:~ }|*3 1672{3:[No Name] }| 1673]] ) 1674command ( 'resize -1' ) 1675screen : expect ( [[ 1676^ | 1677{1:~ }|*2 1678{3:[No Name] }| 1679| 1680]] ) 1681command ( 'resize +1' ) 1682screen : expect ( [[ 1683^ | 1684{1:~ }|*3 1685{3:[No Name] }| 1686]] ) 1687end ) 1688 1689it ( 'can be resized with external messages' , function () 1690clear () 1691screen =Screen . new ( 25 , 5 , { rgb =true , ext_messages =true } ) 1692command ( 'set laststatus=2 mouse=a' ) 1693command ( 'resize -1' ) 1694screen : expect ( [[ 1695^ | 1696{1:~ }|*2 1697{3:[No Name] }| 1698| 1699]] ) 1700api . nvim_input_mouse ( 'left' , 'press' , '' , 0 , 3 , 10 ) 1701poke_eventloop () 1702api . nvim_input_mouse ( 'left' , 'drag' , '' , 0 , 4 , 10 ) 1703screen : expect ( [[ 1704^ | 1705{1:~ }|*3 1706{3:[No Name] }| 1707]] ) 1708end ) 1709 1710it ( 'no spurious newline before first message with --headless mode' , function () 1711local p =n . spawn_wait ( { 1712args ={ '--cmd' , 'set cmdheight=0' , '-c' , 'echo 1' , '+q' } , 1713} ) 1714eq ( '1' , p . stderr ) 1715end ) 1716end )