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 , feed , api =n . clear , n . feed , n . api 7local insert , command =n . insert , n . command 8 9describe ( 'quickfix' , function () 10local screen 11 12before_each ( function () 13clear () 14screen =Screen . new ( 25 , 10 ) 15screen : add_extra_attr_ids ( { 16[ 100 ] ={ foreground =Screen . colors . SlateBlue , background =Screen . colors . WebGreen } , 17[ 101 ] ={ foreground =Screen . colors . Brown , background =Screen . colors . WebGreen } , 18[ 102 ] ={ background =Screen . colors . WebGreen } , 19[ 103 ] ={ background =Screen . colors . Red , foreground =Screen . colors . SlateBlue } , 20[ 104 ] ={ background =Screen . colors . Red , foreground =Screen . colors . Brown } , 21[ 105 ] ={ background =Screen . colors . Fuchsia } , 22[ 106 ] ={ foreground =Screen . colors . Red , background =Screen . colors . Fuchsia } , 23[ 107 ] ={ foreground =Screen . colors . SlateBlue , background =Screen . colors . Fuchsia } , 24[ 108 ] ={ foreground =Screen . colors . Brown , background =Screen . colors . Fuchsia } , 25} ) 26 27api . nvim_set_option_value ( 'errorformat' , '%m %l' , {} ) 28command ( 'syntax on' ) 29command ( 'highlight Search guibg=Green' ) 30 31insert ( [[ 32Line 1 33Line 2 34Line 3 35Line 4 36Line 5 37]] ) 38 39command ( 'cad' ) 40feed ( 'gg' ) 41 42screen : expect ( [[ 43^Line 1 | 44Line 2 | 45Line 3 | 46Line 4 | 47Line 5 | 48| 49{1:~ }|*3 50| 51]] ) 52end ) 53 54it ( 'Search selection highlight' , function () 55command ( 'copen' ) 56 57screen : expect ( [[ 58Line 1 | 59{2:[No Name] [+] }| 60{100:^|}{101:1}{100:|}{102: Line }| 61{16:|}{8:2}{16:|} Line | 62{16:|}{8:3}{16:|} Line | 63{16:|}{8:4}{16:|} Line | 64{16:|}{8:5}{16:|} Line | 65{16:||} | 66{3:[Quickfix List] [-] }| 67| 68]] ) 69 70command ( 'cnext' ) 71 72screen : expect ( [[ 73Line 1 | 74{2:[No Name] [+] }| 75{16:|}{8:1}{16:|} Line | 76{100:^|}{101:2}{100:|}{102: Line }| 77{16:|}{8:3}{16:|} Line | 78{16:|}{8:4}{16:|} Line | 79{16:|}{8:5}{16:|} Line | 80{16:||} | 81{3:[Quickfix List] [-] }| 82| 83]] ) 84end ) 85 86it ( 'QuickFixLine selection highlight' , function () 87command ( 'highlight QuickFixLine guibg=Red guifg=NONE gui=NONE' ) 88 89command ( 'copen' ) 90 91screen : expect ( [[ 92Line 1 | 93{2:[No Name] [+] }| 94{103:^|}{104:1}{103:|}{30: Line }| 95{16:|}{8:2}{16:|} Line | 96{16:|}{8:3}{16:|} Line | 97{16:|}{8:4}{16:|} Line | 98{16:|}{8:5}{16:|} Line | 99{16:||} | 100{3:[Quickfix List] [-] }| 101| 102]] ) 103 104command ( 'cnext' ) 105 106screen : expect ( [[ 107Line 1 | 108{2:[No Name] [+] }| 109{16:|}{8:1}{16:|} Line | 110{103:^|}{104:2}{103:|}{30: Line }| 111{16:|}{8:3}{16:|} Line | 112{16:|}{8:4}{16:|} Line | 113{16:|}{8:5}{16:|} Line | 114{16:||} | 115{3:[Quickfix List] [-] }| 116| 117]] ) 118end ) 119 120it ( 'selection highlight combines with CursorLine' , function () 121command ( 'set cursorline' ) 122command ( 'highlight QuickFixLine guifg=Red guibg=NONE gui=NONE' ) 123command ( 'highlight CursorLine guibg=Fuchsia' ) 124 125command ( 'copen' ) 126 127screen : expect ( [[ 128{105:Line 1 }| 129{2:[No Name] [+] }| 130{106:^|1| Line }| 131{16:|}{8:2}{16:|} Line | 132{16:|}{8:3}{16:|} Line | 133{16:|}{8:4}{16:|} Line | 134{16:|}{8:5}{16:|} Line | 135{16:||} | 136{3:[Quickfix List] [-] }| 137| 138]] ) 139 140feed ( 'j' ) 141 142screen : expect ( [[ 143{105:Line 1 }| 144{2:[No Name] [+] }| 145{19:|1| Line }| 146{107:^|}{108:2}{107:|}{105: Line }| 147{16:|}{8:3}{16:|} Line | 148{16:|}{8:4}{16:|} Line | 149{16:|}{8:5}{16:|} Line | 150{16:||} | 151{3:[Quickfix List] [-] }| 152| 153]] ) 154end ) 155 156it ( 'QuickFixLine selection highlight background takes precedence over CursorLine' , function () 157command ( 'set cursorline' ) 158command ( 'highlight QuickFixLine guibg=Red guifg=NONE gui=NONE' ) 159command ( 'highlight CursorLine guibg=Fuchsia' ) 160 161command ( 'copen' ) 162 163screen : expect ( [[ 164{105:Line 1 }| 165{2:[No Name] [+] }| 166{103:^|}{104:1}{103:|}{30: Line }| 167{16:|}{8:2}{16:|} Line | 168{16:|}{8:3}{16:|} Line | 169{16:|}{8:4}{16:|} Line | 170{16:|}{8:5}{16:|} Line | 171{16:||} | 172{3:[Quickfix List] [-] }| 173| 174]] ) 175 176feed ( 'j' ) 177 178screen : expect ( [[ 179{105:Line 1 }| 180{2:[No Name] [+] }| 181{103:|}{104:1}{103:|}{30: Line }| 182{107:^|}{108:2}{107:|}{105: Line }| 183{16:|}{8:3}{16:|} Line | 184{16:|}{8:4}{16:|} Line | 185{16:|}{8:5}{16:|} Line | 186{16:||} | 187{3:[Quickfix List] [-] }| 188| 189]] ) 190end ) 191 192it ( 'does not inherit from non-current floating window' , function () 193api . nvim_open_win ( 0 , true , { width =6 , height =2 , relative ='win' , bufpos ={ 3 , 0 } } ) 194api . nvim_set_option_value ( 'rightleft' , true , { win =0 } ) 195command ( 'wincmd w | copen' ) 196screen : expect ( [[ 197Line 1 | 198{2:[No Name] [+] }| 199{100:^|}{101:1}{100:|}{102: Line }| 200{16:|}{8:2}{16:|} Line {4:1 eniL}| 201{16:|}{8:3}{16:|} Line {4:2 eniL}| 202{16:|}{8:4}{16:|} Line | 203{16:|}{8:5}{16:|} Line | 204{16:||} | 205{3:[Quickfix List] [-] }| 206| 207]] ) 208end ) 209end )