robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local n =require ( 'test.functional.testnvim' )() 2local t =require ( 'test.testutil' ) 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , it , before_each =t . describe , t . it , t . before_each 6local clear =n . clear 7local command =n . command 8local exec =n . exec 9local feed =n . feed 10 11before_each ( clear ) 12 13describe ( 'breakindent' , function () 14-- oldtest: Test_cursor_position_with_showbreak() 15it ( 'cursor shown at correct position with showbreak' , function () 16local screen =Screen . new ( 75 , 6 ) 17exec ( [[ 18set listchars=eol:$ 19let &signcolumn = 'yes' 20let &showbreak = '++' 21let &breakindentopt = 'shift:2' 22let leftcol = win_getid()->getwininfo()->get(0, {})->get('textoff') 23eval repeat('x', &columns - leftcol - 1)->setline(1) 24eval 'second line'->setline(2) 25]] ) 26 27feed ( 'AX' ) 28screen : expect ( [[ 29{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| 30{7: }^second line | 31{1:~ }|*3 32{5:-- INSERT --} | 33]] ) 34-- No line wraps, so changing 'showbreak' should lead to the same screen. 35command ( 'setlocal showbreak=+' ) 36screen : expect_unchanged () 37-- No line wraps, so setting 'breakindent' should lead to the same screen. 38command ( 'setlocal breakindent' ) 39screen : expect_unchanged () 40-- The first line now wraps because of "eol" in 'listchars'. 41command ( 'setlocal list' ) 42screen : expect ( [[ 43{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| 44{7: } {1:+^$} | 45{7: }second line{1:$} | 46{1:~ }|*2 47{5:-- INSERT --} | 48]] ) 49command ( 'setlocal nobreakindent' ) 50screen : expect ( [[ 51{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| 52{7: }{1:+^$} | 53{7: }second line{1:$} | 54{1:~ }|*2 55{5:-- INSERT --} | 56]] ) 57end ) 58 59-- oldtest: Test_visual_starts_before_skipcol() 60it ( 'Visual selection that starts before skipcol shows correctly' , function () 61local screen =Screen . new ( 75 , 6 ) 62exec ( [[ 631new 64setlocal breakindent 65call setline(1, "\t" .. join(range(100))) 66]] ) 67 68feed ( 'v$' ) 69screen : expect ( [[ 70{1:<<<} {17: 93 94 95 96 97 98 99}^ | 71{3:[No Name] [+] }| 72| 73{1:~ }| 74{2:[No Name] }| 75{5:-- VISUAL --} | 76]] ) 77command ( 'setlocal showbreak=+++' ) 78screen : expect ( [[ 79{1:+++}{17: 90 91 92 93 94 95 96 97 98 99}^ | 80{3:[No Name] [+] }| 81| 82{1:~ }| 83{2:[No Name] }| 84{5:-- VISUAL --} | 85]] ) 86command ( 'setlocal breakindentopt+=sbr' ) 87screen : expect ( [[ 88{1:+++} {17: 93 94 95 96 97 98 99}^ | 89{3:[No Name] [+] }| 90| 91{1:~ }| 92{2:[No Name] }| 93{5:-- VISUAL --} | 94]] ) 95command ( 'setlocal nobreakindent' ) 96screen : expect ( [[ 97{1:+++}{17: 98 99}^ | 98{3:[No Name] [+] }| 99| 100{1:~ }| 101{2:[No Name] }| 102{5:-- VISUAL --} | 103]] ) 104end ) 105end )