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 =t . describe , t . it , t . before_each 6local clear , feed , command =n . clear , n . feed , n . command 7local eq =t . eq 8local insert =n . insert 9local poke_eventloop =n . poke_eventloop 10local exec =n . exec 11 12describe ( 'Screen' , function () 13local screen 14 15before_each ( function () 16clear () 17screen =Screen . new ( nil , 10 ) 18screen : set_default_attr_ids ( { 19[ 0 ] ={ bold =true , foreground =Screen . colors . Blue } , 20[ 1 ] ={ foreground =Screen . colors . LightGrey , background =Screen . colors . DarkGray } , 21[ 2 ] ={ bold =true , reverse =true } , 22[ 3 ] ={ reverse =true } , 23[ 4 ] ={ bold =true } , 24[ 5 ] ={ background =Screen . colors . Yellow } , 25[ 6 ] ={ foreground =Screen . colors . Black , background =Screen . colors . LightGrey } , 26} ) 27end ) 28 29describe ( 'match and conceal' , function () 30before_each ( function () 31command ( 'let &conceallevel=1' ) 32end ) 33 34describe ( 'multiple' , function () 35before_each ( function () 36insert ( [[ 37&& 38&& 39&& 40&& 41&& 42&& 43]] ) 44command ( "syn match dAmpersand '[&][&]' conceal cchar=∧" ) 45end ) 46 47it ( 'double characters.' , function () 48screen : expect ( [[ 49{1:∧} |*6 50^ | 51{0:~ }|*2 52| 53]] ) 54end ) 55 56it ( 'double characters and move the cursor one line up.' , function () 57feed ( 'k' ) 58screen : expect ( [[ 59{1:∧} |*5 60^&& | 61| 62{0:~ }|*2 63| 64]] ) 65end ) 66 67it ( 'double characters and move the cursor to the beginning of the file.' , function () 68feed ( 'gg' ) 69screen : expect ( [[ 70^&& | 71{1:∧} |*5 72| 73{0:~ }|*2 74| 75]] ) 76end ) 77 78it ( 'double characters and move the cursor to the second line in the file.' , function () 79feed ( 'ggj' ) 80screen : expect ( [[ 81{1:∧} | 82^&& | 83{1:∧} |*4 84| 85{0:~ }|*2 86| 87]] ) 88end ) 89 90it ( 91'double characters and then move the cursor to the beginning of the file and back to the end of the file.' , 92function () 93feed ( 'ggG' ) 94screen : expect ( [[ 95{1:∧} |*6 96^ | 97{0:~ }|*2 98| 99]] ) 100end 101) 102end ) -- multiple 103 104it ( 'keyword instances in initially in the document.' , function () 105feed ( '2ilambda<cr><ESC>' ) 106command ( 'let &conceallevel=1' ) 107command ( 'syn keyword kLambda lambda conceal cchar=λ' ) 108screen : expect ( [[ 109{1:λ} |*2 110^ | 111{0:~ }|*6 112| 113]] ) 114end ) -- Keyword 115 116describe ( 'regions in the document' , function () 117before_each ( function () 118feed ( '2' ) 119insert ( '<r> a region of text </r>\n' ) 120command ( 'let &conceallevel=1' ) 121end ) 122 123it ( 'initially and conceal it.' , function () 124command ( "syn region rText start='<r>' end='</r>' conceal cchar=R" ) 125screen : expect ( [[ 126{1:R} |*2 127^ | 128{0:~ }|*6 129| 130]] ) 131end ) 132 133it ( 'initially and conceal its start tag and end tag.' , function () 134-- concealends has a known bug (todo.txt) where the first match won't 135-- be replaced with cchar. 136command ( "syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-" ) 137screen : expect ( [[ 138{1: } a region of text {1:-} |*2 139^ | 140{0:~ }|*6 141| 142]] ) 143end ) 144 145it ( "that are nested and conceal the nested region's start and end tags." , function () 146command ( 147"syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-" 148) 149insert ( '<r> A region with <r> a nested <r> nested region.</r> </r> </r>\n' ) 150screen : expect ( [[ 151{1: } a region of text {1:-} |*2 152{1: } A region with {1: } a nested {1: } nested region.{1:-} | 153{1:-} {1:-} | 154^ | 155{0:~ }|*4 156| 157]] ) 158end ) 159end ) -- regions in the document 160 161describe ( 'a region of text' , function () 162before_each ( function () 163command ( 'syntax conceal on' ) 164feed ( '2' ) 165insert ( '<r> a region of text </r>\n' ) 166command ( "syn region rText start='<r>' end='</r>' cchar=-" ) 167end ) 168 169it ( 'and turn on implicit concealing' , function () 170screen : expect ( [[ 171{1:-} |*2 172^ | 173{0:~ }|*6 174| 175]] ) 176end ) 177 178it ( 'and then turn on, then off, and then back on implicit concealing.' , function () 179command ( 'syntax conceal off' ) 180feed ( '2' ) 181insert ( '<i> italian text </i>\n' ) 182command ( "syn region iText start='<i>' end='</i>' cchar=*" ) 183screen : expect ( [[ 184{1:-} |*2 185<i> italian text </i> |*2 186^ | 187{0:~ }|*4 188| 189]] ) 190command ( 'syntax conceal on' ) 191command ( "syn region iText start='<i>' end='</i>' cchar=*" ) 192screen : expect ( [[ 193{1:-} |*2 194{1:*} |*2 195^ | 196{0:~ }|*4 197| 198]] ) 199end ) 200end ) -- a region of text (implicit concealing) 201 202it ( 'cursor position when entering Insert mode with cocu=ni #13916' , function () 203insert ( [[foobarfoobarfoobar]] ) 204-- move to end of line 205feed ( '$' ) 206command ( 'set concealcursor=ni' ) 207command ( 'syn match Foo /foobar/ conceal cchar=&' ) 208screen : expect ( [[ 209{1:&&&}^ | 210{0:~ }|*8 211| 212]] ) 213feed ( 'i' ) 214-- cursor should stay in place, not jump to column 16 215screen : expect ( [[ 216{1:&&&}^ | 217{0:~ }|*8 218{4:-- INSERT --} | 219]] ) 220end ) 221 222it ( 'cursor position when scrolling in Normal mode with cocu=n #31271' , function () 223insert (( 'foo\n' ): rep ( 9 ) .. 'foofoobarfoofoo' .. ( '\nfoo' ): rep ( 9 )) 224command ( 'set concealcursor=n' ) 225command ( 'syn match Foo /bar/ conceal cchar=&' ) 226feed ( 'gg5<C-E>10gg$' ) 227screen : expect ( [[ 228foo |*4 229foofoo{1:&}foofo^o | 230foo |*4 231| 232]] ) 233feed ( 'zz' ) 234screen : expect_unchanged () 235feed ( 'zt' ) 236screen : expect ( [[ 237foofoo{1:&}foofo^o | 238foo |*8 239| 240]] ) 241feed ( 'zt' ) 242screen : expect_unchanged () 243feed ( 'zb' ) 244screen : expect ( [[ 245foo |*8 246foofoo{1:&}foofo^o | 247| 248]] ) 249feed ( 'zb' ) 250screen : expect_unchanged () 251end ) 252end ) -- match and conceal 253 254describe ( 'let the conceal level be' , function () 255before_each ( function () 256insert ( '// No Conceal\n' ) 257insert ( '"Conceal without a cchar"\n' ) 258insert ( '+ With cchar\n\n' ) 259command ( "syn match noConceal '^//.*$'" ) 260command ( 'syn match concealNoCchar \'".\\{-}"$\' conceal' ) 261command ( "syn match concealWCchar '^+.\\{-}$' conceal cchar=C" ) 262end ) 263 264it ( '0. No concealing.' , function () 265command ( 'let &conceallevel=0' ) 266screen : expect ( [[ 267// No Conceal | 268"Conceal without a cchar" | 269+ With cchar | 270| 271^ | 272{0:~ }|*4 273| 274]] ) 275end ) 276 277it ( '1. Conceal using cchar or reference listchars.' , function () 278command ( 'let &conceallevel=1' ) 279screen : expect ( [[ 280// No Conceal | 281{1: } | 282{1:C} | 283| 284^ | 285{0:~ }|*4 286| 287]] ) 288end ) 289 290it ( '2. Hidden unless cchar is set.' , function () 291command ( 'let &conceallevel=2' ) 292screen : expect ( [[ 293// No Conceal | 294| 295{1:C} | 296| 297^ | 298{0:~ }|*4 299| 300]] ) 301end ) 302 303it ( '3. Hide all concealed text.' , function () 304command ( 'let &conceallevel=3' ) 305screen : expect ( [[ 306// No Conceal | 307|*3 308^ | 309{0:~ }|*4 310| 311]] ) 312end ) 313end ) -- conceallevel 314 315describe ( 'cursor movement' , function () 316before_each ( function () 317command ( 'syn keyword concealy barf conceal cchar=b' ) 318command ( 'set cole=2' ) 319feed ( '5Ofoo barf bar barf eggs<esc>' ) 320screen : expect ( [[ 321foo {1:b} bar {1:b} eggs |*4 322foo barf bar barf egg^s | 323| 324{0:~ }|*3 325| 326]] ) 327end ) 328 329it ( 'between windows' , function () 330feed ( 'k' ) 331command ( 'split' ) 332screen : expect ( [[ 333foo {1:b} bar {1:b} eggs | 334foo barf bar barf egg^s | 335foo {1:b} bar {1:b} eggs | 336| 337{2:[No Name] [+] }| 338foo {1:b} bar {1:b} eggs |*3 339{3:[No Name] [+] }| 340| 341]] ) 342feed ( '<c-w>w' ) 343 344screen : expect ( [[ 345foo {1:b} bar {1:b} eggs |*3 346| 347{3:[No Name] [+] }| 348foo {1:b} bar {1:b} eggs | 349foo barf bar barf egg^s | 350foo {1:b} bar {1:b} eggs | 351{2:[No Name] [+] }| 352| 353]] ) 354end ) 355 356it ( 'in insert mode' , function () 357feed ( 'i' ) 358screen : expect ( [[ 359foo {1:b} bar {1:b} eggs |*4 360foo barf bar barf egg^s | 361| 362{0:~ }|*3 363{4:-- INSERT --} | 364]] ) 365 366feed ( '<up>' ) 367screen : expect ( [[ 368foo {1:b} bar {1:b} eggs |*3 369foo barf bar barf egg^s | 370foo {1:b} bar {1:b} eggs | 371| 372{0:~ }|*3 373{4:-- INSERT --} | 374]] ) 375end ) 376 377it ( 'between modes cocu=iv' , function () 378command ( 'set cocu=iv' ) 379feed ( 'gg' ) 380screen : expect ( [[ 381^foo barf bar barf eggs | 382foo {1:b} bar {1:b} eggs |*4 383| 384{0:~ }|*3 385| 386]] ) 387 388feed ( 'i' ) 389screen : expect ( [[ 390^foo {1:b} bar {1:b} eggs | 391foo {1:b} bar {1:b} eggs |*4 392| 393{0:~ }|*3 394{4:-- INSERT --} | 395]] ) 396 397feed ( '<esc>' ) 398screen : expect ( [[ 399^foo barf bar barf eggs | 400foo {1:b} bar {1:b} eggs |*4 401| 402{0:~ }|*3 403| 404]] ) 405 406feed ( 'v' ) 407screen : expect ( [[ 408{6:^f}oo {1:b} bar {1:b} eggs | 409foo {1:b} bar {1:b} eggs |*4 410| 411{0:~ }|*3 412{4:-- VISUAL --} | 413]] ) 414 415feed ( '<esc>' ) 416screen : expect ( [[ 417^foo barf bar barf eggs | 418foo {1:b} bar {1:b} eggs |*4 419| 420{0:~ }|*3 421| 422]] ) 423end ) 424 425it ( 'between modes cocu=n' , function () 426command ( 'set cocu=n' ) 427feed ( 'gg' ) 428screen : expect ( [[ 429^foo {1:b} bar {1:b} eggs | 430foo {1:b} bar {1:b} eggs |*4 431| 432{0:~ }|*3 433| 434]] ) 435 436feed ( 'i' ) 437screen : expect ( [[ 438^foo barf bar barf eggs | 439foo {1:b} bar {1:b} eggs |*4 440| 441{0:~ }|*3 442{4:-- INSERT --} | 443]] ) 444 445feed ( '<esc>' ) 446screen : expect ( [[ 447^foo {1:b} bar {1:b} eggs | 448foo {1:b} bar {1:b} eggs |*4 449| 450{0:~ }|*3 451| 452]] ) 453 454feed ( 'v' ) 455screen : expect ( [[ 456{6:^f}oo barf bar barf eggs | 457foo {1:b} bar {1:b} eggs |*4 458| 459{0:~ }|*3 460{4:-- VISUAL --} | 461]] ) 462 463feed ( '<esc>' ) 464screen : expect ( [[ 465^foo {1:b} bar {1:b} eggs | 466foo {1:b} bar {1:b} eggs |*4 467| 468{0:~ }|*3 469| 470]] ) 471 472feed ( 'r' ) 473screen : expect_unchanged () 474 475feed ( 'm' ) 476screen : expect ( [[ 477^moo {1:b} bar {1:b} eggs | 478foo {1:b} bar {1:b} eggs |*4 479| 480{0:~ }|*3 481| 482]] ) 483end ) 484 485it ( 'and open line' , function () 486feed ( 'o' ) 487screen : expect ( [[ 488foo {1:b} bar {1:b} eggs |*5 489^ | 490| 491{0:~ }|*2 492{4:-- INSERT --} | 493]] ) 494end ) 495 496it ( 'and open line cocu=i' , function () 497command ( 'set cocu=i' ) 498feed ( 'o' ) 499screen : expect ( [[ 500foo {1:b} bar {1:b} eggs |*5 501^ | 502| 503{0:~ }|*2 504{4:-- INSERT --} | 505]] ) 506end ) 507 508describe ( 'with incsearch' , function () 509before_each ( function () 510command ( 'set incsearch hlsearch' ) 511feed ( '2GA x<esc>3GA xy<esc>gg' ) 512screen : expect ( [[ 513^foo barf bar barf eggs | 514foo {1:b} bar {1:b} eggs x | 515foo {1:b} bar {1:b} eggs xy | 516foo {1:b} bar {1:b} eggs |*2 517| 518{0:~ }|*3 519| 520]] ) 521end ) 522 523it ( 'cocu=' , function () 524feed ( '/' ) 525screen : expect ( [[ 526foo barf bar barf eggs | 527foo {1:b} bar {1:b} eggs x | 528foo {1:b} bar {1:b} eggs xy | 529foo {1:b} bar {1:b} eggs |*2 530| 531{0:~ }|*3 532/^ | 533]] ) 534 535feed ( 'x' ) 536screen : expect ( [[ 537foo {1:b} bar {1:b} eggs | 538foo barf bar barf eggs {3:x} | 539foo {1:b} bar {1:b} eggs {5:x}y | 540foo {1:b} bar {1:b} eggs |*2 541| 542{0:~ }|*3 543/x^ | 544]] ) 545 546feed ( 'y' ) 547screen : expect ( [[ 548foo {1:b} bar {1:b} eggs | 549foo {1:b} bar {1:b} eggs x | 550foo barf bar barf eggs {3:xy} | 551foo {1:b} bar {1:b} eggs |*2 552| 553{0:~ }|*3 554/xy^ | 555]] ) 556 557feed ( '<c-w>' ) 558screen : expect ( [[ 559foo barf bar barf eggs | 560foo {1:b} bar {1:b} eggs x | 561foo {1:b} bar {1:b} eggs xy | 562foo {1:b} bar {1:b} eggs |*2 563| 564{0:~ }|*3 565/^ | 566]] ) 567end ) 568 569it ( 'cocu=c' , function () 570command ( 'set cocu=c' ) 571 572feed ( '/' ) 573-- NB: we don't do this redraw. Probably best to still skip it, 574-- to avoid annoying distraction from the cmdline 575screen : expect ( [[ 576foo barf bar barf eggs | 577foo {1:b} bar {1:b} eggs x | 578foo {1:b} bar {1:b} eggs xy | 579foo {1:b} bar {1:b} eggs |*2 580| 581{0:~ }|*3 582/^ | 583]] ) 584 585feed ( 'x' ) 586screen : expect ( [[ 587foo {1:b} bar {1:b} eggs | 588foo {1:b} bar {1:b} eggs {3:x} | 589foo {1:b} bar {1:b} eggs {5:x}y | 590foo {1:b} bar {1:b} eggs |*2 591| 592{0:~ }|*3 593/x^ | 594]] ) 595 596feed ( 'y' ) 597screen : expect ( [[ 598foo {1:b} bar {1:b} eggs | 599foo {1:b} bar {1:b} eggs x | 600foo {1:b} bar {1:b} eggs {3:xy} | 601foo {1:b} bar {1:b} eggs |*2 602| 603{0:~ }|*3 604/xy^ | 605]] ) 606 607feed ( '<c-w>' ) 608screen : expect ( [[ 609foo {1:b} bar {1:b} eggs | 610foo {1:b} bar {1:b} eggs x | 611foo {1:b} bar {1:b} eggs xy | 612foo {1:b} bar {1:b} eggs |*2 613| 614{0:~ }|*3 615/^ | 616]] ) 617 618feed ( '<esc>' ) 619screen : expect ( [[ 620^foo barf bar barf eggs | 621foo {1:b} bar {1:b} eggs x | 622foo {1:b} bar {1:b} eggs xy | 623foo {1:b} bar {1:b} eggs |*2 624| 625{0:~ }|*3 626| 627]] ) 628end ) 629 630it ( 'cocu=n' , function () 631command ( 'set cocu=n' ) 632screen : expect ( [[ 633^foo {1:b} bar {1:b} eggs | 634foo {1:b} bar {1:b} eggs x | 635foo {1:b} bar {1:b} eggs xy | 636foo {1:b} bar {1:b} eggs |*2 637| 638{0:~ }|*3 639| 640]] ) 641 642feed ( '/' ) 643-- NB: we don't do this redraw. Probably best to still skip it, 644-- to avoid annoying distraction from the cmdline 645screen : expect ( [[ 646foo {1:b} bar {1:b} eggs | 647foo {1:b} bar {1:b} eggs x | 648foo {1:b} bar {1:b} eggs xy | 649foo {1:b} bar {1:b} eggs |*2 650| 651{0:~ }|*3 652/^ | 653]] ) 654 655feed ( 'x' ) 656screen : expect ( [[ 657foo {1:b} bar {1:b} eggs | 658foo barf bar barf eggs {3:x} | 659foo {1:b} bar {1:b} eggs {5:x}y | 660foo {1:b} bar {1:b} eggs |*2 661| 662{0:~ }|*3 663/x^ | 664]] ) 665 666feed ( '<c-w>' ) 667screen : expect ( [[ 668foo barf bar barf eggs | 669foo {1:b} bar {1:b} eggs x | 670foo {1:b} bar {1:b} eggs xy | 671foo {1:b} bar {1:b} eggs |*2 672| 673{0:~ }|*3 674/^ | 675]] ) 676 677feed ( '<esc>' ) 678screen : expect ( [[ 679^foo {1:b} bar {1:b} eggs | 680foo {1:b} bar {1:b} eggs x | 681foo {1:b} bar {1:b} eggs xy | 682foo {1:b} bar {1:b} eggs |*2 683| 684{0:~ }|*3 685| 686]] ) 687end ) 688end ) 689 690it ( 'redraws properly with concealcursor in visual mode' , function () 691command ( 'set concealcursor=v conceallevel=2' ) 692 693feed ( '10Ofoo barf bar barf eggs<esc>' ) 694feed ( ':3<cr>o a<Esc>ggV' ) 695screen : expect { 696grid =[[ 697{6:^foo }{1:b}{6: bar }{1:b}{6: eggs} | 698foo {1:b} bar {1:b} eggs |*2 699a | 700foo {1:b} bar {1:b} eggs |*5 701{4:-- VISUAL LINE --} | 702]] , 703} 704feed ( string . rep ( 'j' , 15 )) 705screen : expect { 706grid =[[ 707{6:foo }{1:b}{6: bar }{1:b}{6: eggs} |*8 708{6:^foo }{1:b}{6: bar }{1:b}{6: eggs} | 709{4:-- VISUAL LINE --} | 710]] , 711} 712feed ( string . rep ( 'k' , 15 )) 713screen : expect { 714grid =[[ 715{6:^foo }{1:b}{6: bar }{1:b}{6: eggs} | 716foo {1:b} bar {1:b} eggs |*2 717a | 718foo {1:b} bar {1:b} eggs |*5 719{4:-- VISUAL LINE --} | 720]] , 721} 722end ) 723end ) 724 725it ( 'redraws not too much with conceallevel=1' , function () 726command ( 'set conceallevel=1' ) 727command ( 'set redrawdebug+=nodelta' ) 728 729insert ( [[ 730aaa 731bbb 732ccc 733]] ) 734screen : expect { 735grid =[[ 736aaa | 737bbb | 738ccc | 739^ | 740{0:~ }|*5 741| 742]] , 743} 744 745-- XXX: hack to get notifications, and check only a single line is 746-- updated. Could use next_msg() also. 747local orig_handle_grid_line =screen . _handle_grid_line 748local grid_lines ={} 749function screen . _handle_grid_line ( self , grid , row , col , items ) 750table . insert ( grid_lines , { row , col , items } ) 751orig_handle_grid_line ( self , grid , row , col , items ) 752end 753feed ( 'k' ) 754screen : expect { 755grid =[[ 756aaa | 757bbb | 758^ccc | 759| 760{0:~ }|*5 761| 762]] , 763} 764eq ( { { 2 , 0 , { { 'c' , 0 , 3 } , { ' ' , 0 , 50 } } } , { 3 , 0 , { { ' ' , 0 , 53 } } } } , grid_lines ) 765end ) 766 767it ( 'K_EVENT should not cause extra redraws with concealcursor #13196' , function () 768command ( 'set conceallevel=1' ) 769command ( 'set concealcursor=nv' ) 770command ( 'set redrawdebug+=nodelta' ) 771 772insert ( [[ 773aaa 774bbb 775ccc 776]] ) 777screen : expect { 778grid =[[ 779aaa | 780bbb | 781ccc | 782^ | 783{0:~ }|*5 784| 785]] , 786} 787 788-- XXX: hack to get notifications, and check only a single line is 789-- updated. Could use next_msg() also. 790local orig_handle_grid_line =screen . _handle_grid_line 791local grid_lines ={} 792function screen . _handle_grid_line ( self , grid , row , col , items ) 793table . insert ( grid_lines , { row , col , items } ) 794orig_handle_grid_line ( self , grid , row , col , items ) 795end 796feed ( 'k' ) 797screen : expect { 798grid =[[ 799aaa | 800bbb | 801^ccc | 802| 803{0:~ }|*5 804| 805]] , 806} 807eq ( { { 2 , 0 , { { 'c' , 0 , 3 } , { ' ' , 0 , 50 } } } } , grid_lines ) 808grid_lines ={} 809poke_eventloop () -- causes K_EVENT key 810screen : expect_unchanged () 811eq ( {} , grid_lines ) -- no redraw was done 812end ) 813 814describe ( 'concealed line has the correct cursor column' , function () 815-- oldtest: Test_cursor_column_in_concealed_line_after_window_scroll() 816it ( 'after window scroll' , function () 817insert ( [[ 8183split 819let m = matchadd('Conceal', '=') 820setl conceallevel=2 concealcursor=nc 821normal gg 822"==expr==]] ) 823feed ( 'gg' ) 824command ( 'file Xcolesearch' ) 825command ( 'set nomodified' ) 826 827command ( 'so' ) 828screen : expect { 829grid =[[ 830^3split | 831let m matchadd('Conceal', '') | 832setl conceallevel2 concealcursornc | 833{2:Xcolesearch }| 8343split | 835let m = matchadd('Conceal', '=') | 836setl conceallevel=2 concealcursor=nc | 837normal gg | 838{3:Xcolesearch }| 839| 840]] , 841} 842 843-- Jump to something that is beyond the bottom of the window, 844-- so there's a scroll down. 845feed ( '/expr<CR>' ) 846 847-- Are the concealed parts of the current line really hidden? 848-- Is the window's cursor column properly updated for hidden 849-- parts of the current line? 850screen : expect { 851grid =[[ 852setl conceallevel2 concealcursornc | 853normal gg | 854"{5:^expr} | 855{2:Xcolesearch }| 8563split | 857let m = matchadd('Conceal', '=') | 858setl conceallevel=2 concealcursor=nc | 859normal gg | 860{3:Xcolesearch }| 861/expr | 862]] , 863} 864end ) 865 866-- oldtest: Test_cursor_column_in_concealed_line_after_leftcol_change() 867it ( 'after leftcol change' , function () 868exec ( [[ 8690put = 'ab' .. repeat('-', &columns) .. 'c' 870call matchadd('Conceal', '-') 871set nowrap ss=0 cole=3 cocu=n 872]] ) 873 874-- Go to the end of the line (3 columns beyond the end of the screen). 875-- Horizontal scroll would center the cursor in the screen line, but conceal 876-- makes it go to screen column 1. 877feed ( '$' ) 878 879-- Are the concealed parts of the current line really hidden? 880-- Is the window's cursor column properly updated for conceal? 881screen : expect { 882grid =[[ 883^c | 884| 885{0:~ }|*7 886| 887]] , 888} 889end ) 890end ) 891end )