float_spec.lua 271 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local os = require('os')
  4. local clear, feed = helpers.clear, helpers.feed
  5. local assert_alive = helpers.assert_alive
  6. local command, feed_command = helpers.command, helpers.feed_command
  7. local eval = helpers.eval
  8. local eq = helpers.eq
  9. local exec_lua = helpers.exec_lua
  10. local insert = helpers.insert
  11. local meths = helpers.meths
  12. local curbufmeths = helpers.curbufmeths
  13. local funcs = helpers.funcs
  14. local run = helpers.run
  15. local pcall_err = helpers.pcall_err
  16. describe('float window', function()
  17. before_each(function()
  18. clear()
  19. end)
  20. local attrs = {
  21. [0] = {bold=true, foreground=Screen.colors.Blue},
  22. [1] = {background = Screen.colors.LightMagenta},
  23. [2] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1},
  24. [3] = {bold = true},
  25. [4] = {bold = true, reverse = true},
  26. [5] = {reverse = true},
  27. [6] = {background = Screen.colors.LightMagenta, bold = true, reverse = true},
  28. [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  29. [8] = {bold = true, foreground = Screen.colors.SeaGreen4},
  30. [9] = {background = Screen.colors.LightGrey, underline = true},
  31. [10] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
  32. [11] = {bold = true, foreground = Screen.colors.Magenta},
  33. [12] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Blue1},
  34. [13] = {background = Screen.colors.WebGray},
  35. [14] = {foreground = Screen.colors.Brown},
  36. [15] = {background = Screen.colors.Grey20},
  37. [16] = {background = Screen.colors.Grey20, bold = true, foreground = Screen.colors.Blue1},
  38. [17] = {background = Screen.colors.Yellow},
  39. [18] = {foreground = Screen.colors.Brown, background = Screen.colors.Grey20},
  40. [19] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
  41. [20] = {bold = true, foreground = Screen.colors.Brown},
  42. [21] = {background = Screen.colors.Gray90},
  43. [22] = {background = Screen.colors.LightRed},
  44. [23] = {foreground = Screen.colors.Black, background = Screen.colors.White};
  45. [24] = {foreground = Screen.colors.Black, background = Screen.colors.Grey80};
  46. [25] = {blend = 100, background = Screen.colors.Gray0};
  47. [26] = {blend = 80, background = Screen.colors.Gray0};
  48. }
  49. it('behavior', function()
  50. -- Create three windows and test that ":wincmd <direction>" changes to the
  51. -- first window, if the previous window is invalid.
  52. command('split')
  53. meths.open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0})
  54. eq(1002, funcs.win_getid())
  55. eq('editor', meths.win_get_config(1002).relative)
  56. command([[
  57. call nvim_win_close(1001, v:false)
  58. wincmd j
  59. ]])
  60. eq(1000, funcs.win_getid())
  61. end)
  62. it('win_execute() should work' , function()
  63. local buf = meths.create_buf(false, false)
  64. meths.buf_set_lines(buf, 0, -1, true, {'the floatwin', 'abc', 'def'})
  65. local win = meths.open_win(buf, false, {relative='win', width=16, height=1, row=0, col=10})
  66. local line = funcs.win_execute(win, 'echo getline(1)')
  67. eq('\nthe floatwin', line)
  68. eq('\n1', funcs.win_execute(win, 'echo line(".",'..win.id..')'))
  69. eq('\n3', funcs.win_execute(win, 'echo line("$",'..win.id..')'))
  70. eq('\n0', funcs.win_execute(win, 'echo line("$", 123456)'))
  71. funcs.win_execute(win, 'bwipe!')
  72. end)
  73. it('win_execute() call commands that not allowed' , function()
  74. local buf = meths.create_buf(false, false)
  75. meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'})
  76. local win = meths.open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10})
  77. eq(pcall_err(funcs.win_execute, win, 'close'), 'Vim(close):E37: No write since last change (add ! to override)')
  78. eq(pcall_err(funcs.win_execute, win, 'bdelete'), 'Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)')
  79. funcs.win_execute(win, 'bwipe!')
  80. end)
  81. it('closed immediately by autocmd #11383', function()
  82. eq('Error executing lua: [string "<nvim>"]:0: Window was closed immediately',
  83. pcall_err(exec_lua, [[
  84. local a = vim.api
  85. local function crashes(contents)
  86. local buf = a.nvim_create_buf(false, true)
  87. local floatwin = a.nvim_open_win(buf, true, {
  88. relative = 'cursor';
  89. style = 'minimal';
  90. row = 0; col = 0;
  91. height = #contents;
  92. width = 10;
  93. })
  94. a.nvim_buf_set_lines(buf, 0, -1, true, contents)
  95. local winnr = vim.fn.win_id2win(floatwin)
  96. a.nvim_command('wincmd p')
  97. a.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c')
  98. return buf, floatwin
  99. end
  100. crashes{'foo'}
  101. crashes{'bar'}
  102. ]]))
  103. assert_alive()
  104. end)
  105. it('opened with correct height', function()
  106. local height = exec_lua([[
  107. vim.api.nvim_set_option("winheight", 20)
  108. local bufnr = vim.api.nvim_create_buf(false, true)
  109. local opts = {
  110. height = 10,
  111. col = 5,
  112. row = 1,
  113. relative = 'editor',
  114. style = 'minimal',
  115. width = 15
  116. }
  117. local win_id = vim.api.nvim_open_win(bufnr, true, opts)
  118. return vim.api.nvim_win_get_height(win_id)
  119. ]])
  120. eq(10, height)
  121. end)
  122. it('opened with correct width', function()
  123. local width = exec_lua([[
  124. vim.api.nvim_set_option("winwidth", 20)
  125. local bufnr = vim.api.nvim_create_buf(false, true)
  126. local opts = {
  127. height = 10,
  128. col = 5,
  129. row = 1,
  130. relative = 'editor',
  131. style = 'minimal',
  132. width = 10
  133. }
  134. local win_id = vim.api.nvim_open_win(bufnr, true, opts)
  135. return vim.api.nvim_win_get_width(win_id)
  136. ]])
  137. eq(10, width)
  138. end)
  139. it('opened with correct position', function()
  140. local pos = exec_lua([[
  141. local bufnr = vim.api.nvim_create_buf(false, true)
  142. local opts = {
  143. width = 10,
  144. height = 10,
  145. col = 7,
  146. row = 9,
  147. relative = 'editor',
  148. style = 'minimal'
  149. }
  150. local win_id = vim.api.nvim_open_win(bufnr, false, opts)
  151. return vim.api.nvim_win_get_position(win_id)
  152. ]])
  153. eq(9, pos[1])
  154. eq(7, pos[2])
  155. end)
  156. it('opened with correct position relative to the cursor', function()
  157. local pos = exec_lua([[
  158. local bufnr = vim.api.nvim_create_buf(false, true)
  159. local opts = {
  160. width = 10,
  161. height = 10,
  162. col = 7,
  163. row = 9,
  164. relative = 'cursor',
  165. style = 'minimal'
  166. }
  167. local win_id = vim.api.nvim_open_win(bufnr, false, opts)
  168. return vim.api.nvim_win_get_position(win_id)
  169. ]])
  170. eq(9, pos[1])
  171. eq(7, pos[2])
  172. end)
  173. it('opened with correct position relative to another window', function()
  174. local pos = exec_lua([[
  175. local bufnr = vim.api.nvim_create_buf(false, true)
  176. local par_opts = {
  177. width = 50,
  178. height = 50,
  179. col = 7,
  180. row = 9,
  181. relative = 'editor',
  182. style = 'minimal'
  183. }
  184. local par_win_id = vim.api.nvim_open_win(bufnr, false, par_opts)
  185. local opts = {
  186. width = 10,
  187. height = 10,
  188. col = 7,
  189. row = 9,
  190. relative = 'win',
  191. style = 'minimal',
  192. win = par_win_id
  193. }
  194. local win_id = vim.api.nvim_open_win(bufnr, false, opts)
  195. return vim.api.nvim_win_get_position(win_id)
  196. ]])
  197. eq(18, pos[1])
  198. eq(14, pos[2])
  199. end)
  200. it('opened with correct position relative to another relative window', function()
  201. local pos = exec_lua([[
  202. local bufnr = vim.api.nvim_create_buf(false, true)
  203. local root_opts = {
  204. width = 50,
  205. height = 50,
  206. col = 7,
  207. row = 9,
  208. relative = 'editor',
  209. style = 'minimal'
  210. }
  211. local root_win_id = vim.api.nvim_open_win(bufnr, false, root_opts)
  212. local par_opts = {
  213. width = 20,
  214. height = 20,
  215. col = 2,
  216. row = 3,
  217. relative = 'win',
  218. win = root_win_id,
  219. style = 'minimal'
  220. }
  221. local par_win_id = vim.api.nvim_open_win(bufnr, false, par_opts)
  222. local opts = {
  223. width = 10,
  224. height = 10,
  225. col = 3,
  226. row = 2,
  227. relative = 'win',
  228. win = par_win_id,
  229. style = 'minimal'
  230. }
  231. local win_id = vim.api.nvim_open_win(bufnr, false, opts)
  232. return vim.api.nvim_win_get_position(win_id)
  233. ]])
  234. eq(14, pos[1])
  235. eq(12, pos[2])
  236. end)
  237. local function with_ext_multigrid(multigrid)
  238. local screen
  239. before_each(function()
  240. screen = Screen.new(40,7)
  241. screen:attach {ext_multigrid=multigrid}
  242. screen:set_default_attr_ids(attrs)
  243. end)
  244. it('can be created and reconfigured', function()
  245. local buf = meths.create_buf(false,false)
  246. local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  247. local expected_pos = {
  248. [4]={{id=1001}, 'NW', 1, 2, 5, true},
  249. }
  250. if multigrid then
  251. screen:expect{grid=[[
  252. ## grid 1
  253. [2:----------------------------------------]|
  254. [2:----------------------------------------]|
  255. [2:----------------------------------------]|
  256. [2:----------------------------------------]|
  257. [2:----------------------------------------]|
  258. [2:----------------------------------------]|
  259. [3:----------------------------------------]|
  260. ## grid 2
  261. ^ |
  262. {0:~ }|
  263. {0:~ }|
  264. {0:~ }|
  265. {0:~ }|
  266. {0:~ }|
  267. ## grid 3
  268. |
  269. ## grid 4
  270. {1: }|
  271. {2:~ }|
  272. ]], float_pos=expected_pos}
  273. else
  274. screen:expect([[
  275. ^ |
  276. {0:~ }|
  277. {0:~ }{1: }{0: }|
  278. {0:~ }{2:~ }{0: }|
  279. {0:~ }|
  280. {0:~ }|
  281. |
  282. ]])
  283. end
  284. meths.win_set_config(win, {relative='editor', row=0, col=10})
  285. expected_pos[4][4] = 0
  286. expected_pos[4][5] = 10
  287. if multigrid then
  288. screen:expect{grid=[[
  289. ## grid 1
  290. [2:----------------------------------------]|
  291. [2:----------------------------------------]|
  292. [2:----------------------------------------]|
  293. [2:----------------------------------------]|
  294. [2:----------------------------------------]|
  295. [2:----------------------------------------]|
  296. [3:----------------------------------------]|
  297. ## grid 2
  298. ^ |
  299. {0:~ }|
  300. {0:~ }|
  301. {0:~ }|
  302. {0:~ }|
  303. {0:~ }|
  304. ## grid 3
  305. |
  306. ## grid 4
  307. {1: }|
  308. {2:~ }|
  309. ]], float_pos=expected_pos}
  310. else
  311. screen:expect([[
  312. ^ {1: } |
  313. {0:~ }{2:~ }{0: }|
  314. {0:~ }|
  315. {0:~ }|
  316. {0:~ }|
  317. {0:~ }|
  318. |
  319. ]])
  320. end
  321. meths.win_close(win, false)
  322. if multigrid then
  323. screen:expect([[
  324. ## grid 1
  325. [2:----------------------------------------]|
  326. [2:----------------------------------------]|
  327. [2:----------------------------------------]|
  328. [2:----------------------------------------]|
  329. [2:----------------------------------------]|
  330. [2:----------------------------------------]|
  331. [3:----------------------------------------]|
  332. ## grid 2
  333. ^ |
  334. {0:~ }|
  335. {0:~ }|
  336. {0:~ }|
  337. {0:~ }|
  338. {0:~ }|
  339. ## grid 3
  340. |
  341. ]])
  342. else
  343. screen:expect([[
  344. ^ |
  345. {0:~ }|
  346. {0:~ }|
  347. {0:~ }|
  348. {0:~ }|
  349. {0:~ }|
  350. |
  351. ]])
  352. end
  353. end)
  354. it('draws correctly with redrawdebug=compositor', function()
  355. -- NB: we do not test that it produces the "correct" debug info
  356. -- (as it is intermediate only, and is allowed to change by internal
  357. -- refactors). Only check that it doesn't cause permanent glitches,
  358. -- or something.
  359. command("set redrawdebug=compositor")
  360. command("set wd=1")
  361. local buf = meths.create_buf(false,false)
  362. local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  363. local expected_pos = {
  364. [4]={{id=1001}, 'NW', 1, 2, 5, true},
  365. }
  366. if multigrid then
  367. screen:expect{grid=[[
  368. ## grid 1
  369. [2:----------------------------------------]|
  370. [2:----------------------------------------]|
  371. [2:----------------------------------------]|
  372. [2:----------------------------------------]|
  373. [2:----------------------------------------]|
  374. [2:----------------------------------------]|
  375. [3:----------------------------------------]|
  376. ## grid 2
  377. ^ |
  378. {0:~ }|
  379. {0:~ }|
  380. {0:~ }|
  381. {0:~ }|
  382. {0:~ }|
  383. ## grid 3
  384. |
  385. ## grid 4
  386. {1: }|
  387. {2:~ }|
  388. ]], float_pos=expected_pos}
  389. else
  390. screen:expect([[
  391. ^ |
  392. {0:~ }|
  393. {0:~ }{1: }{0: }|
  394. {0:~ }{2:~ }{0: }|
  395. {0:~ }|
  396. {0:~ }|
  397. |
  398. ]])
  399. end
  400. meths.win_set_config(win, {relative='editor', row=0, col=10})
  401. expected_pos[4][4] = 0
  402. expected_pos[4][5] = 10
  403. if multigrid then
  404. screen:expect{grid=[[
  405. ## grid 1
  406. [2:----------------------------------------]|
  407. [2:----------------------------------------]|
  408. [2:----------------------------------------]|
  409. [2:----------------------------------------]|
  410. [2:----------------------------------------]|
  411. [2:----------------------------------------]|
  412. [3:----------------------------------------]|
  413. ## grid 2
  414. ^ |
  415. {0:~ }|
  416. {0:~ }|
  417. {0:~ }|
  418. {0:~ }|
  419. {0:~ }|
  420. ## grid 3
  421. |
  422. ## grid 4
  423. {1: }|
  424. {2:~ }|
  425. ]], float_pos=expected_pos}
  426. else
  427. screen:expect([[
  428. ^ {1: } |
  429. {0:~ }{2:~ }{0: }|
  430. {0:~ }|
  431. {0:~ }|
  432. {0:~ }|
  433. {0:~ }|
  434. |
  435. ]])
  436. end
  437. meths.win_close(win, false)
  438. if multigrid then
  439. screen:expect([[
  440. ## grid 1
  441. [2:----------------------------------------]|
  442. [2:----------------------------------------]|
  443. [2:----------------------------------------]|
  444. [2:----------------------------------------]|
  445. [2:----------------------------------------]|
  446. [2:----------------------------------------]|
  447. [3:----------------------------------------]|
  448. ## grid 2
  449. ^ |
  450. {0:~ }|
  451. {0:~ }|
  452. {0:~ }|
  453. {0:~ }|
  454. {0:~ }|
  455. ## grid 3
  456. |
  457. ]])
  458. else
  459. screen:expect([[
  460. ^ |
  461. {0:~ }|
  462. {0:~ }|
  463. {0:~ }|
  464. {0:~ }|
  465. {0:~ }|
  466. |
  467. ]])
  468. end
  469. end)
  470. it('return their configuration', function()
  471. local buf = meths.create_buf(false, false)
  472. local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60})
  473. local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60}
  474. eq(expected, meths.win_get_config(win))
  475. eq({relative='', external=false, focusable=true}, meths.win_get_config(0))
  476. if multigrid then
  477. meths.win_set_config(win, {external=true, width=10, height=1})
  478. eq({external=true,focusable=true,width=10,height=1,relative=''}, meths.win_get_config(win))
  479. end
  480. end)
  481. it('defaults to NormalFloat highlight and inherited options', function()
  482. command('set number')
  483. command('hi NormalFloat guibg=#333333')
  484. feed('ix<cr>y<cr><esc>gg')
  485. local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10})
  486. if multigrid then
  487. screen:expect{grid=[[
  488. ## grid 1
  489. [2:----------------------------------------]|
  490. [2:----------------------------------------]|
  491. [2:----------------------------------------]|
  492. [2:----------------------------------------]|
  493. [2:----------------------------------------]|
  494. [2:----------------------------------------]|
  495. [3:----------------------------------------]|
  496. ## grid 2
  497. {14: 1 }^x |
  498. {14: 2 }y |
  499. {14: 3 } |
  500. {0:~ }|
  501. {0:~ }|
  502. {0:~ }|
  503. ## grid 3
  504. |
  505. ## grid 4
  506. {18: 1 }{15:x }|
  507. {18: 2 }{15:y }|
  508. {18: 3 }{15: }|
  509. {16:~ }|
  510. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  511. else
  512. screen:expect([[
  513. {14: 1 }^x |
  514. {14: 2 }y |
  515. {14: 3 } {18: 1 }{15:x } |
  516. {0:~ }{18: 2 }{15:y }{0: }|
  517. {0:~ }{18: 3 }{15: }{0: }|
  518. {0:~ }{16:~ }{0: }|
  519. |
  520. ]])
  521. end
  522. local buf = meths.create_buf(false, true)
  523. meths.win_set_buf(win, buf)
  524. if multigrid then
  525. screen:expect{grid=[[
  526. ## grid 1
  527. [2:----------------------------------------]|
  528. [2:----------------------------------------]|
  529. [2:----------------------------------------]|
  530. [2:----------------------------------------]|
  531. [2:----------------------------------------]|
  532. [2:----------------------------------------]|
  533. [3:----------------------------------------]|
  534. ## grid 2
  535. {14: 1 }^x |
  536. {14: 2 }y |
  537. {14: 3 } |
  538. {0:~ }|
  539. {0:~ }|
  540. {0:~ }|
  541. ## grid 3
  542. |
  543. ## grid 4
  544. {18: 1 }{15: }|
  545. {16:~ }|
  546. {16:~ }|
  547. {16:~ }|
  548. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  549. else
  550. screen:expect([[
  551. {14: 1 }^x |
  552. {14: 2 }y |
  553. {14: 3 } {18: 1 }{15: } |
  554. {0:~ }{16:~ }{0: }|
  555. {0:~ }{16:~ }{0: }|
  556. {0:~ }{16:~ }{0: }|
  557. |
  558. ]])
  559. end
  560. end)
  561. it("can use 'minimal' style", function()
  562. command('set number')
  563. command('set signcolumn=yes')
  564. command('set colorcolumn=1')
  565. command('set cursorline')
  566. command('set foldcolumn=1')
  567. command('hi NormalFloat guibg=#333333')
  568. feed('ix<cr>y<cr><esc>gg')
  569. local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
  570. if multigrid then
  571. screen:expect{grid=[[
  572. ## grid 1
  573. [2:----------------------------------------]|
  574. [2:----------------------------------------]|
  575. [2:----------------------------------------]|
  576. [2:----------------------------------------]|
  577. [2:----------------------------------------]|
  578. [2:----------------------------------------]|
  579. [3:----------------------------------------]|
  580. ## grid 2
  581. {19: }{20: 1 }{22:^x}{21: }|
  582. {19: }{14: 2 }{22:y} |
  583. {19: }{14: 3 }{22: } |
  584. {0:~ }|
  585. {0:~ }|
  586. {0:~ }|
  587. ## grid 3
  588. |
  589. ## grid 4
  590. {15:x }|
  591. {15:y }|
  592. {15: }|
  593. {15: }|
  594. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  595. else
  596. screen:expect{grid=[[
  597. {19: }{20: 1 }{22:^x}{21: }|
  598. {19: }{14: 2 }{22:y} |
  599. {19: }{14: 3 }{22: } {15:x } |
  600. {0:~ }{15:y }{0: }|
  601. {0:~ }{15: }{0: }|
  602. {0:~ }{15: }{0: }|
  603. |
  604. ]]}
  605. end
  606. -- signcolumn=yes still works if there actually are signs
  607. command('sign define piet1 text=𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄ texthl=Search')
  608. command('sign place 1 line=1 name=piet1 buffer=1')
  609. if multigrid then
  610. screen:expect{grid=[[
  611. ## grid 1
  612. [2:----------------------------------------]|
  613. [2:----------------------------------------]|
  614. [2:----------------------------------------]|
  615. [2:----------------------------------------]|
  616. [2:----------------------------------------]|
  617. [2:----------------------------------------]|
  618. [3:----------------------------------------]|
  619. ## grid 2
  620. {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
  621. {19: }{14: 2 }{22:y} |
  622. {19: }{14: 3 }{22: } |
  623. {0:~ }|
  624. {0:~ }|
  625. {0:~ }|
  626. ## grid 3
  627. |
  628. ## grid 4
  629. {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }|
  630. {19: }{15:y }|
  631. {19: }{15: }|
  632. {15: }|
  633. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  634. else
  635. screen:expect([[
  636. {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
  637. {19: }{14: 2 }{22:y} |
  638. {19: }{14: 3 }{22: } {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } |
  639. {0:~ }{19: }{15:y }{0: }|
  640. {0:~ }{19: }{15: }{0: }|
  641. {0:~ }{15: }{0: }|
  642. |
  643. ]])
  644. end
  645. command('sign unplace 1 buffer=1')
  646. local buf = meths.create_buf(false, true)
  647. meths.win_set_buf(win, buf)
  648. if multigrid then
  649. screen:expect{grid=[[
  650. ## grid 1
  651. [2:----------------------------------------]|
  652. [2:----------------------------------------]|
  653. [2:----------------------------------------]|
  654. [2:----------------------------------------]|
  655. [2:----------------------------------------]|
  656. [2:----------------------------------------]|
  657. [3:----------------------------------------]|
  658. ## grid 2
  659. {19: }{20: 1 }{22:^x}{21: }|
  660. {19: }{14: 2 }{22:y} |
  661. {19: }{14: 3 }{22: } |
  662. {0:~ }|
  663. {0:~ }|
  664. {0:~ }|
  665. ## grid 3
  666. |
  667. ## grid 4
  668. {15: }|
  669. {15: }|
  670. {15: }|
  671. {15: }|
  672. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  673. else
  674. screen:expect([[
  675. {19: }{20: 1 }{22:^x}{21: }|
  676. {19: }{14: 2 }{22:y} |
  677. {19: }{14: 3 }{22: } {15: } |
  678. {0:~ }{15: }{0: }|
  679. {0:~ }{15: }{0: }|
  680. {0:~ }{15: }{0: }|
  681. |
  682. ]])
  683. end
  684. end)
  685. it("would not break 'minimal' style with signcolumn=auto:[min]-[max]", function()
  686. command('set number')
  687. command('set signcolumn=auto:1-3')
  688. command('set colorcolumn=1')
  689. command('set cursorline')
  690. command('set foldcolumn=1')
  691. command('hi NormalFloat guibg=#333333')
  692. feed('ix<cr>y<cr><esc>gg')
  693. local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'})
  694. if multigrid then
  695. screen:expect{grid=[[
  696. ## grid 1
  697. [2:----------------------------------------]|
  698. [2:----------------------------------------]|
  699. [2:----------------------------------------]|
  700. [2:----------------------------------------]|
  701. [2:----------------------------------------]|
  702. [2:----------------------------------------]|
  703. [3:----------------------------------------]|
  704. ## grid 2
  705. {19: }{20: 1 }{22:^x}{21: }|
  706. {19: }{14: 2 }{22:y} |
  707. {19: }{14: 3 }{22: } |
  708. {0:~ }|
  709. {0:~ }|
  710. {0:~ }|
  711. ## grid 3
  712. |
  713. ## grid 4
  714. {15:x }|
  715. {15:y }|
  716. {15: }|
  717. {15: }|
  718. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  719. else
  720. screen:expect{grid=[[
  721. {19: }{20: 1 }{22:^x}{21: }|
  722. {19: }{14: 2 }{22:y} |
  723. {19: }{14: 3 }{22: } {15:x } |
  724. {0:~ }{15:y }{0: }|
  725. {0:~ }{15: }{0: }|
  726. {0:~ }{15: }{0: }|
  727. |
  728. ]]}
  729. end
  730. command('sign define piet1 text=𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄ texthl=Search')
  731. command('sign place 1 line=1 name=piet1 buffer=1')
  732. -- signcolumn=auto:1-3 still works if there actually are signs
  733. if multigrid then
  734. screen:expect{grid=[[
  735. ## grid 1
  736. [2:----------------------------------------]|
  737. [2:----------------------------------------]|
  738. [2:----------------------------------------]|
  739. [2:----------------------------------------]|
  740. [2:----------------------------------------]|
  741. [2:----------------------------------------]|
  742. [3:----------------------------------------]|
  743. ## grid 2
  744. {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
  745. {19: }{14: 2 }{22:y} |
  746. {19: }{14: 3 }{22: } |
  747. {0:~ }|
  748. {0:~ }|
  749. {0:~ }|
  750. ## grid 3
  751. |
  752. ## grid 4
  753. {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x }|
  754. {19: }{15:y }|
  755. {19: }{15: }|
  756. {15: }|
  757. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  758. else
  759. screen:expect([[
  760. {19: }{17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{20: 1 }{22:^x}{21: }|
  761. {19: }{14: 2 }{22:y} |
  762. {19: }{14: 3 }{22: } {17:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}{15:x } |
  763. {0:~ }{19: }{15:y }{0: }|
  764. {0:~ }{19: }{15: }{0: }|
  765. {0:~ }{15: }{0: }|
  766. |
  767. ]])
  768. end
  769. command('sign unplace 1 buffer=1')
  770. local buf = meths.create_buf(false, true)
  771. meths.win_set_buf(win, buf)
  772. if multigrid then
  773. screen:expect{grid=[[
  774. ## grid 1
  775. [2:----------------------------------------]|
  776. [2:----------------------------------------]|
  777. [2:----------------------------------------]|
  778. [2:----------------------------------------]|
  779. [2:----------------------------------------]|
  780. [2:----------------------------------------]|
  781. [3:----------------------------------------]|
  782. ## grid 2
  783. {19: }{20: 1 }{22:^x}{21: }|
  784. {19: }{14: 2 }{22:y} |
  785. {19: }{14: 3 }{22: } |
  786. {0:~ }|
  787. {0:~ }|
  788. {0:~ }|
  789. ## grid 3
  790. |
  791. ## grid 4
  792. {15: }|
  793. {15: }|
  794. {15: }|
  795. {15: }|
  796. ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
  797. else
  798. screen:expect([[
  799. {19: }{20: 1 }{22:^x}{21: }|
  800. {19: }{14: 2 }{22:y} |
  801. {19: }{14: 3 }{22: } {15: } |
  802. {0:~ }{15: }{0: }|
  803. {0:~ }{15: }{0: }|
  804. {0:~ }{15: }{0: }|
  805. |
  806. ]])
  807. end
  808. end)
  809. it('can have border', function()
  810. local buf = meths.create_buf(false, false)
  811. meths.buf_set_lines(buf, 0, -1, true, {' halloj! ',
  812. ' BORDAA '})
  813. local win = meths.open_win(buf, false, {relative='editor', width=9, height=2, row=2, col=5, border="double"})
  814. if multigrid then
  815. screen:expect{grid=[[
  816. ## grid 1
  817. [2:----------------------------------------]|
  818. [2:----------------------------------------]|
  819. [2:----------------------------------------]|
  820. [2:----------------------------------------]|
  821. [2:----------------------------------------]|
  822. [2:----------------------------------------]|
  823. [3:----------------------------------------]|
  824. ## grid 2
  825. ^ |
  826. {0:~ }|
  827. {0:~ }|
  828. {0:~ }|
  829. {0:~ }|
  830. {0:~ }|
  831. ## grid 3
  832. |
  833. ## grid 5
  834. {5:╔═════════╗}|
  835. {5:║}{1: halloj! }{5:║}|
  836. {5:║}{1: BORDAA }{5:║}|
  837. {5:╚═════════╝}|
  838. ]], float_pos={
  839. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  840. }, win_viewport={
  841. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  842. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  843. }}
  844. else
  845. screen:expect{grid=[[
  846. ^ |
  847. {0:~ }|
  848. {0:~ }{5:╔═════════╗}{0: }|
  849. {0:~ }{5:║}{1: halloj! }{5:║}{0: }|
  850. {0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
  851. {0:~ }{5:╚═════════╝}{0: }|
  852. |
  853. ]]}
  854. end
  855. meths.win_set_config(win, {border="single"})
  856. if multigrid then
  857. screen:expect{grid=[[
  858. ## grid 1
  859. [2:----------------------------------------]|
  860. [2:----------------------------------------]|
  861. [2:----------------------------------------]|
  862. [2:----------------------------------------]|
  863. [2:----------------------------------------]|
  864. [2:----------------------------------------]|
  865. [3:----------------------------------------]|
  866. ## grid 2
  867. ^ |
  868. {0:~ }|
  869. {0:~ }|
  870. {0:~ }|
  871. {0:~ }|
  872. {0:~ }|
  873. ## grid 3
  874. |
  875. ## grid 5
  876. {5:┌─────────┐}|
  877. {5:│}{1: halloj! }{5:│}|
  878. {5:│}{1: BORDAA }{5:│}|
  879. {5:└─────────┘}|
  880. ]], float_pos={
  881. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  882. }, win_viewport={
  883. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  884. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  885. }}
  886. else
  887. screen:expect{grid=[[
  888. ^ |
  889. {0:~ }|
  890. {0:~ }{5:┌─────────┐}{0: }|
  891. {0:~ }{5:│}{1: halloj! }{5:│}{0: }|
  892. {0:~ }{5:│}{1: BORDAA }{5:│}{0: }|
  893. {0:~ }{5:└─────────┘}{0: }|
  894. |
  895. ]]}
  896. end
  897. meths.win_set_config(win, {border="rounded"})
  898. if multigrid then
  899. screen:expect{grid=[[
  900. ## grid 1
  901. [2:----------------------------------------]|
  902. [2:----------------------------------------]|
  903. [2:----------------------------------------]|
  904. [2:----------------------------------------]|
  905. [2:----------------------------------------]|
  906. [2:----------------------------------------]|
  907. [3:----------------------------------------]|
  908. ## grid 2
  909. ^ |
  910. {0:~ }|
  911. {0:~ }|
  912. {0:~ }|
  913. {0:~ }|
  914. {0:~ }|
  915. ## grid 3
  916. |
  917. ## grid 5
  918. {5:╭─────────╮}|
  919. {5:│}{1: halloj! }{5:│}|
  920. {5:│}{1: BORDAA }{5:│}|
  921. {5:╰─────────╯}|
  922. ]], float_pos={
  923. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  924. }, win_viewport={
  925. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  926. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  927. }}
  928. else
  929. screen:expect{grid=[[
  930. ^ |
  931. {0:~ }|
  932. {0:~ }{5:╭─────────╮}{0: }|
  933. {0:~ }{5:│}{1: halloj! }{5:│}{0: }|
  934. {0:~ }{5:│}{1: BORDAA }{5:│}{0: }|
  935. {0:~ }{5:╰─────────╯}{0: }|
  936. |
  937. ]]}
  938. end
  939. meths.win_set_config(win, {border="solid"})
  940. if multigrid then
  941. screen:expect{grid=[[
  942. ## grid 1
  943. [2:----------------------------------------]|
  944. [2:----------------------------------------]|
  945. [2:----------------------------------------]|
  946. [2:----------------------------------------]|
  947. [2:----------------------------------------]|
  948. [2:----------------------------------------]|
  949. [3:----------------------------------------]|
  950. ## grid 2
  951. ^ |
  952. {0:~ }|
  953. {0:~ }|
  954. {0:~ }|
  955. {0:~ }|
  956. {0:~ }|
  957. ## grid 3
  958. |
  959. ## grid 5
  960. {5: }|
  961. {5: }{1: halloj! }{5: }|
  962. {5: }{1: BORDAA }{5: }|
  963. {5: }|
  964. ]], float_pos={
  965. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  966. }, win_viewport={
  967. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  968. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  969. }}
  970. else
  971. screen:expect{grid=[[
  972. ^ |
  973. {0:~ }|
  974. {0:~ }{5: }{0: }|
  975. {0:~ }{5: }{1: halloj! }{5: }{0: }|
  976. {0:~ }{5: }{1: BORDAA }{5: }{0: }|
  977. {0:~ }{5: }{0: }|
  978. |
  979. ]]}
  980. end
  981. -- support: ascii char, UTF-8 char, composed char, highlight per char
  982. meths.win_set_config(win, {border={"x", {"å", "ErrorMsg"}, {"\\"}, {"n̈̊", "Search"}}})
  983. if multigrid then
  984. screen:expect{grid=[[
  985. ## grid 1
  986. [2:----------------------------------------]|
  987. [2:----------------------------------------]|
  988. [2:----------------------------------------]|
  989. [2:----------------------------------------]|
  990. [2:----------------------------------------]|
  991. [2:----------------------------------------]|
  992. [3:----------------------------------------]|
  993. ## grid 2
  994. ^ |
  995. {0:~ }|
  996. {0:~ }|
  997. {0:~ }|
  998. {0:~ }|
  999. {0:~ }|
  1000. ## grid 3
  1001. |
  1002. ## grid 5
  1003. {5:x}{7:ååååååååå}{5:\}|
  1004. {17:n̈̊}{1: halloj! }{17:n̈̊}|
  1005. {17:n̈̊}{1: BORDAA }{17:n̈̊}|
  1006. {5:\}{7:ååååååååå}{5:x}|
  1007. ]], float_pos={
  1008. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  1009. }, win_viewport={
  1010. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1011. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1012. }}
  1013. else
  1014. screen:expect{grid=[[
  1015. ^ |
  1016. {0:~ }|
  1017. {0:~ }{5:x}{7:ååååååååå}{5:\}{0: }|
  1018. {0:~ }{17:n̈̊}{1: halloj! }{17:n̈̊}{0: }|
  1019. {0:~ }{17:n̈̊}{1: BORDAA }{17:n̈̊}{0: }|
  1020. {0:~ }{5:\}{7:ååååååååå}{5:x}{0: }|
  1021. |
  1022. ]]}
  1023. end
  1024. meths.win_set_config(win, {border="none"})
  1025. if multigrid then
  1026. screen:expect{grid=[[
  1027. ## grid 1
  1028. [2:----------------------------------------]|
  1029. [2:----------------------------------------]|
  1030. [2:----------------------------------------]|
  1031. [2:----------------------------------------]|
  1032. [2:----------------------------------------]|
  1033. [2:----------------------------------------]|
  1034. [3:----------------------------------------]|
  1035. ## grid 2
  1036. ^ |
  1037. {0:~ }|
  1038. {0:~ }|
  1039. {0:~ }|
  1040. {0:~ }|
  1041. {0:~ }|
  1042. ## grid 3
  1043. |
  1044. ## grid 5
  1045. {1: halloj! }|
  1046. {1: BORDAA }|
  1047. ]], float_pos={
  1048. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  1049. }, win_viewport={
  1050. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1051. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1052. }}
  1053. else
  1054. screen:expect{grid=[[
  1055. ^ |
  1056. {0:~ }|
  1057. {0:~ }{1: halloj! }{0: }|
  1058. {0:~ }{1: BORDAA }{0: }|
  1059. {0:~ }|
  1060. {0:~ }|
  1061. |
  1062. ]]}
  1063. end
  1064. meths.win_set_config(win, {border={"", "", "", ">", "", "", "", "<"}})
  1065. if multigrid then
  1066. screen:expect{grid=[[
  1067. ## grid 1
  1068. [2:----------------------------------------]|
  1069. [2:----------------------------------------]|
  1070. [2:----------------------------------------]|
  1071. [2:----------------------------------------]|
  1072. [2:----------------------------------------]|
  1073. [2:----------------------------------------]|
  1074. [3:----------------------------------------]|
  1075. ## grid 2
  1076. ^ |
  1077. {0:~ }|
  1078. {0:~ }|
  1079. {0:~ }|
  1080. {0:~ }|
  1081. {0:~ }|
  1082. ## grid 3
  1083. |
  1084. ## grid 5
  1085. {5:<}{1: halloj! }{5:>}|
  1086. {5:<}{1: BORDAA }{5:>}|
  1087. ]], float_pos={
  1088. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  1089. }, win_viewport={
  1090. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1091. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1092. }}
  1093. else
  1094. screen:expect{grid=[[
  1095. ^ |
  1096. {0:~ }|
  1097. {0:~ }{5:<}{1: halloj! }{5:>}{0: }|
  1098. {0:~ }{5:<}{1: BORDAA }{5:>}{0: }|
  1099. {0:~ }|
  1100. {0:~ }|
  1101. |
  1102. ]]}
  1103. end
  1104. insert [[
  1105. neeed some dummy
  1106. background text
  1107. to show the effect
  1108. of color blending
  1109. of border shadow
  1110. ]]
  1111. meths.win_set_config(win, {border="shadow"})
  1112. if multigrid then
  1113. screen:expect{grid=[[
  1114. ## grid 1
  1115. [2:----------------------------------------]|
  1116. [2:----------------------------------------]|
  1117. [2:----------------------------------------]|
  1118. [2:----------------------------------------]|
  1119. [2:----------------------------------------]|
  1120. [2:----------------------------------------]|
  1121. [3:----------------------------------------]|
  1122. ## grid 2
  1123. neeed some dummy |
  1124. background text |
  1125. to show the effect |
  1126. of color blending |
  1127. of border shadow |
  1128. ^ |
  1129. ## grid 3
  1130. |
  1131. ## grid 5
  1132. {1: halloj! }{25: }|
  1133. {1: BORDAA }{26: }|
  1134. {25: }{26: }|
  1135. ]], float_pos={
  1136. [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
  1137. }, win_viewport={
  1138. [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0};
  1139. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1140. }}
  1141. else
  1142. screen:expect{grid=[[
  1143. neeed some dummy |
  1144. background text |
  1145. to {1: halloj! }{23:e}ffect |
  1146. of {1: BORDAA }{24:n}ding |
  1147. of {23:b}{24:order sha}dow |
  1148. ^ |
  1149. |
  1150. ]]}
  1151. end
  1152. end)
  1153. it('terminates border on edge of viewport when window extends past viewport', function()
  1154. local buf = meths.create_buf(false, false)
  1155. meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single"})
  1156. if multigrid then
  1157. screen:expect{grid=[[
  1158. ## grid 1
  1159. [2:----------------------------------------]|
  1160. [2:----------------------------------------]|
  1161. [2:----------------------------------------]|
  1162. [2:----------------------------------------]|
  1163. [2:----------------------------------------]|
  1164. [2:----------------------------------------]|
  1165. [3:----------------------------------------]|
  1166. ## grid 2
  1167. ^ |
  1168. {0:~ }|
  1169. {0:~ }|
  1170. {0:~ }|
  1171. {0:~ }|
  1172. {0:~ }|
  1173. ## grid 3
  1174. |
  1175. ## grid 4
  1176. {5:┌────────────────────────────────────────┐}|
  1177. {5:│}{1: }{5:│}|
  1178. {5:│}{2:~ }{5:│}|
  1179. {5:│}{2:~ }{5:│}|
  1180. {5:│}{2:~ }{5:│}|
  1181. {5:│}{2:~ }{5:│}|
  1182. {5:│}{2:~ }{5:│}|
  1183. {5:│}{2:~ }{5:│}|
  1184. {5:└────────────────────────────────────────┘}|
  1185. ]], float_pos={
  1186. [4] = { { id = 1001 }, "NW", 1, 0, 0, true }
  1187. }, win_viewport={
  1188. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1189. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1190. }}
  1191. else
  1192. screen:expect{grid=[[
  1193. {5:^┌──────────────────────────────────────┐}|
  1194. {5:│}{1: }{5:│}|
  1195. {5:│}{2:~ }{5:│}|
  1196. {5:│}{2:~ }{5:│}|
  1197. {5:│}{2:~ }{5:│}|
  1198. {5:└──────────────────────────────────────┘}|
  1199. |
  1200. ]]}
  1201. end
  1202. end)
  1203. it('with border show popupmenu', function()
  1204. screen:try_resize(40,10)
  1205. local buf = meths.create_buf(false, false)
  1206. meths.buf_set_lines(buf, 0, -1, true, {'aaa aab ',
  1207. 'abb acc ', ''})
  1208. meths.open_win(buf, true, {relative='editor', width=9, height=3, row=0, col=5, border="double"})
  1209. feed 'G'
  1210. if multigrid then
  1211. screen:expect{grid=[[
  1212. ## grid 1
  1213. [2:----------------------------------------]|
  1214. [2:----------------------------------------]|
  1215. [2:----------------------------------------]|
  1216. [2:----------------------------------------]|
  1217. [2:----------------------------------------]|
  1218. [2:----------------------------------------]|
  1219. [2:----------------------------------------]|
  1220. [2:----------------------------------------]|
  1221. [2:----------------------------------------]|
  1222. [3:----------------------------------------]|
  1223. ## grid 2
  1224. |
  1225. {0:~ }|
  1226. {0:~ }|
  1227. {0:~ }|
  1228. {0:~ }|
  1229. {0:~ }|
  1230. {0:~ }|
  1231. {0:~ }|
  1232. {0:~ }|
  1233. ## grid 3
  1234. |
  1235. ## grid 5
  1236. {5:╔═════════╗}|
  1237. {5:║}{1:aaa aab }{5:║}|
  1238. {5:║}{1:abb acc }{5:║}|
  1239. {5:║}{1:^ }{5:║}|
  1240. {5:╚═════════╝}|
  1241. ]], float_pos={
  1242. [5] = { { id = 1002 }, "NW", 1, 0, 5, true }
  1243. }, win_viewport={
  1244. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1245. [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0};
  1246. }}
  1247. else
  1248. screen:expect{grid=[[
  1249. {5:╔═════════╗} |
  1250. {0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
  1251. {0:~ }{5:║}{1:abb acc }{5:║}{0: }|
  1252. {0:~ }{5:║}{1:^ }{5:║}{0: }|
  1253. {0:~ }{5:╚═════════╝}{0: }|
  1254. {0:~ }|
  1255. {0:~ }|
  1256. {0:~ }|
  1257. {0:~ }|
  1258. |
  1259. ]]}
  1260. end
  1261. feed 'i<c-x><c-p>'
  1262. if multigrid then
  1263. screen:expect{grid=[[
  1264. ## grid 1
  1265. [2:----------------------------------------]|
  1266. [2:----------------------------------------]|
  1267. [2:----------------------------------------]|
  1268. [2:----------------------------------------]|
  1269. [2:----------------------------------------]|
  1270. [2:----------------------------------------]|
  1271. [2:----------------------------------------]|
  1272. [2:----------------------------------------]|
  1273. [2:----------------------------------------]|
  1274. [3:----------------------------------------]|
  1275. ## grid 2
  1276. |
  1277. {0:~ }|
  1278. {0:~ }|
  1279. {0:~ }|
  1280. {0:~ }|
  1281. {0:~ }|
  1282. {0:~ }|
  1283. {0:~ }|
  1284. {0:~ }|
  1285. ## grid 3
  1286. {3:-- }{8:match 1 of 4} |
  1287. ## grid 5
  1288. {5:╔═════════╗}|
  1289. {5:║}{1:aaa aab }{5:║}|
  1290. {5:║}{1:abb acc }{5:║}|
  1291. {5:║}{1:acc^ }{5:║}|
  1292. {5:╚═════════╝}|
  1293. ## grid 6
  1294. {1: aaa }|
  1295. {1: aab }|
  1296. {1: abb }|
  1297. {13: acc }|
  1298. ]], float_pos={
  1299. [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
  1300. [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
  1301. }, win_viewport={
  1302. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  1303. [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3};
  1304. }}
  1305. else
  1306. screen:expect{grid=[[
  1307. {5:╔═════════╗} |
  1308. {0:~ }{5:║}{1:aaa aab }{5:║}{0: }|
  1309. {0:~ }{5:║}{1:abb acc }{5:║}{0: }|
  1310. {0:~ }{5:║}{1:acc^ }{5:║}{0: }|
  1311. {0:~ }{1: aaa }{0: }|
  1312. {0:~ }{1: aab }{0: }|
  1313. {0:~ }{1: abb }{0: }|
  1314. {0:~ }{13: acc }{0: }|
  1315. {0:~ }|
  1316. {3:-- }{8:match 1 of 4} |
  1317. ]]}
  1318. end
  1319. end)
  1320. it('can have minimum size', function()
  1321. insert("the background text")
  1322. local buf = meths.create_buf(false, true)
  1323. meths.buf_set_lines(buf, 0, -1, true, {'x'})
  1324. local win = meths.open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false})
  1325. if multigrid then
  1326. screen:expect{grid=[[
  1327. ## grid 1
  1328. [2:----------------------------------------]|
  1329. [2:----------------------------------------]|
  1330. [2:----------------------------------------]|
  1331. [2:----------------------------------------]|
  1332. [2:----------------------------------------]|
  1333. [2:----------------------------------------]|
  1334. [3:----------------------------------------]|
  1335. ## grid 2
  1336. the background tex^t |
  1337. {0:~ }|
  1338. {0:~ }|
  1339. {0:~ }|
  1340. {0:~ }|
  1341. {0:~ }|
  1342. ## grid 3
  1343. |
  1344. ## grid 5
  1345. {1:x}|
  1346. ]], float_pos={
  1347. [5] = {{id = 1002}, "NW", 2, 0, 4, false}
  1348. }}
  1349. else
  1350. screen:expect([[
  1351. the {1:x}ackground tex^t |
  1352. {0:~ }|
  1353. {0:~ }|
  1354. {0:~ }|
  1355. {0:~ }|
  1356. {0:~ }|
  1357. |
  1358. ]])
  1359. end
  1360. meths.win_set_config(win, {relative='win', row=0, col=15})
  1361. if multigrid then
  1362. screen:expect{grid=[[
  1363. ## grid 1
  1364. [2:----------------------------------------]|
  1365. [2:----------------------------------------]|
  1366. [2:----------------------------------------]|
  1367. [2:----------------------------------------]|
  1368. [2:----------------------------------------]|
  1369. [2:----------------------------------------]|
  1370. [3:----------------------------------------]|
  1371. ## grid 2
  1372. the background tex^t |
  1373. {0:~ }|
  1374. {0:~ }|
  1375. {0:~ }|
  1376. {0:~ }|
  1377. {0:~ }|
  1378. ## grid 3
  1379. |
  1380. ## grid 5
  1381. {1:x}|
  1382. ]], float_pos={
  1383. [5] = {{id = 1002}, "NW", 2, 0, 15, false}
  1384. }}
  1385. else
  1386. screen:expect([[
  1387. the background {1:x}ex^t |
  1388. {0:~ }|
  1389. {0:~ }|
  1390. {0:~ }|
  1391. {0:~ }|
  1392. {0:~ }|
  1393. |
  1394. ]])
  1395. end
  1396. meths.win_close(win,false)
  1397. if multigrid then
  1398. screen:expect([[
  1399. ## grid 1
  1400. [2:----------------------------------------]|
  1401. [2:----------------------------------------]|
  1402. [2:----------------------------------------]|
  1403. [2:----------------------------------------]|
  1404. [2:----------------------------------------]|
  1405. [2:----------------------------------------]|
  1406. [3:----------------------------------------]|
  1407. ## grid 2
  1408. the background tex^t |
  1409. {0:~ }|
  1410. {0:~ }|
  1411. {0:~ }|
  1412. {0:~ }|
  1413. {0:~ }|
  1414. ## grid 3
  1415. |
  1416. ]])
  1417. else
  1418. screen:expect([[
  1419. the background tex^t |
  1420. {0:~ }|
  1421. {0:~ }|
  1422. {0:~ }|
  1423. {0:~ }|
  1424. {0:~ }|
  1425. |
  1426. ]])
  1427. end
  1428. end)
  1429. it('API has proper error messages', function()
  1430. local buf = meths.create_buf(false,false)
  1431. eq("Invalid key 'bork'",
  1432. pcall_err(meths.open_win,buf, false, {width=20,height=2,bork=true}))
  1433. eq("'win' key is only valid with relative='win'",
  1434. pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0}))
  1435. eq("Only one of 'relative' and 'external' must be used",
  1436. pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true}))
  1437. eq("Invalid value of 'relative' key",
  1438. pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0}))
  1439. eq("Invalid value of 'anchor' key",
  1440. pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'}))
  1441. eq("'relative' requires 'row'/'col' or 'bufpos'",
  1442. pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor'}))
  1443. eq("'width' key must be a positive Integer",
  1444. pcall_err(meths.open_win,buf, false, {width=-1,height=2,relative='editor'}))
  1445. eq("'height' key must be a positive Integer",
  1446. pcall_err(meths.open_win,buf, false, {width=20,height=-1,relative='editor'}))
  1447. eq("'height' key must be a positive Integer",
  1448. pcall_err(meths.open_win,buf, false, {width=20,height=0,relative='editor'}))
  1449. eq("Must specify 'width' and 'height'",
  1450. pcall_err(meths.open_win,buf, false, {relative='editor'}))
  1451. end)
  1452. it('can be placed relative window or cursor', function()
  1453. screen:try_resize(40,9)
  1454. meths.buf_set_lines(0, 0, -1, true, {'just some', 'example text'})
  1455. feed('gge')
  1456. local oldwin = meths.get_current_win()
  1457. command('below split')
  1458. if multigrid then
  1459. screen:expect([[
  1460. ## grid 1
  1461. [2:----------------------------------------]|
  1462. [2:----------------------------------------]|
  1463. [2:----------------------------------------]|
  1464. {5:[No Name] [+] }|
  1465. [4:----------------------------------------]|
  1466. [4:----------------------------------------]|
  1467. [4:----------------------------------------]|
  1468. {4:[No Name] [+] }|
  1469. [3:----------------------------------------]|
  1470. ## grid 2
  1471. just some |
  1472. example text |
  1473. {0:~ }|
  1474. ## grid 3
  1475. |
  1476. ## grid 4
  1477. jus^t some |
  1478. example text |
  1479. {0:~ }|
  1480. ]])
  1481. else
  1482. screen:expect([[
  1483. just some |
  1484. example text |
  1485. {0:~ }|
  1486. {5:[No Name] [+] }|
  1487. jus^t some |
  1488. example text |
  1489. {0:~ }|
  1490. {4:[No Name] [+] }|
  1491. |
  1492. ]])
  1493. end
  1494. local buf = meths.create_buf(false,false)
  1495. -- no 'win' arg, relative default window
  1496. local win = meths.open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10})
  1497. if multigrid then
  1498. screen:expect{grid=[[
  1499. ## grid 1
  1500. [2:----------------------------------------]|
  1501. [2:----------------------------------------]|
  1502. [2:----------------------------------------]|
  1503. {5:[No Name] [+] }|
  1504. [4:----------------------------------------]|
  1505. [4:----------------------------------------]|
  1506. [4:----------------------------------------]|
  1507. {4:[No Name] [+] }|
  1508. [3:----------------------------------------]|
  1509. ## grid 2
  1510. just some |
  1511. example text |
  1512. {0:~ }|
  1513. ## grid 3
  1514. |
  1515. ## grid 4
  1516. jus^t some |
  1517. example text |
  1518. {0:~ }|
  1519. ## grid 5
  1520. {1: }|
  1521. {2:~ }|
  1522. ]], float_pos={
  1523. [5] = {{id = 1002}, "NW", 4, 0, 10, true}
  1524. }}
  1525. else
  1526. screen:expect([[
  1527. just some |
  1528. example text |
  1529. {0:~ }|
  1530. {5:[No Name] [+] }|
  1531. jus^t some {1: } |
  1532. example te{2:~ } |
  1533. {0:~ }|
  1534. {4:[No Name] [+] }|
  1535. |
  1536. ]])
  1537. end
  1538. meths.win_set_config(win, {relative='cursor', row=1, col=-2})
  1539. if multigrid then
  1540. screen:expect{grid=[[
  1541. ## grid 1
  1542. [2:----------------------------------------]|
  1543. [2:----------------------------------------]|
  1544. [2:----------------------------------------]|
  1545. {5:[No Name] [+] }|
  1546. [4:----------------------------------------]|
  1547. [4:----------------------------------------]|
  1548. [4:----------------------------------------]|
  1549. {4:[No Name] [+] }|
  1550. [3:----------------------------------------]|
  1551. ## grid 2
  1552. just some |
  1553. example text |
  1554. {0:~ }|
  1555. ## grid 3
  1556. |
  1557. ## grid 4
  1558. jus^t some |
  1559. example text |
  1560. {0:~ }|
  1561. ## grid 5
  1562. {1: }|
  1563. {2:~ }|
  1564. ]], float_pos={
  1565. [5] = {{id = 1002}, "NW", 4, 1, 1, true}
  1566. }}
  1567. else
  1568. screen:expect([[
  1569. just some |
  1570. example text |
  1571. {0:~ }|
  1572. {5:[No Name] [+] }|
  1573. jus^t some |
  1574. e{1: } |
  1575. {0:~}{2:~ }{0: }|
  1576. {4:[No Name] [+] }|
  1577. |
  1578. ]])
  1579. end
  1580. meths.win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'})
  1581. if multigrid then
  1582. screen:expect{grid=[[
  1583. ## grid 1
  1584. [2:----------------------------------------]|
  1585. [2:----------------------------------------]|
  1586. [2:----------------------------------------]|
  1587. {5:[No Name] [+] }|
  1588. [4:----------------------------------------]|
  1589. [4:----------------------------------------]|
  1590. [4:----------------------------------------]|
  1591. {4:[No Name] [+] }|
  1592. [3:----------------------------------------]|
  1593. ## grid 2
  1594. just some |
  1595. example text |
  1596. {0:~ }|
  1597. ## grid 3
  1598. |
  1599. ## grid 4
  1600. jus^t some |
  1601. example text |
  1602. {0:~ }|
  1603. ## grid 5
  1604. {1: }|
  1605. {2:~ }|
  1606. ]], float_pos={
  1607. [5] = {{id = 1002}, "SW", 4, 0, 3, true}
  1608. }}
  1609. else
  1610. screen:expect([[
  1611. just some |
  1612. example text |
  1613. {0:~ }{1: }{0: }|
  1614. {5:[No}{2:~ }{5: }|
  1615. jus^t some |
  1616. example text |
  1617. {0:~ }|
  1618. {4:[No Name] [+] }|
  1619. |
  1620. ]])
  1621. end
  1622. meths.win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'})
  1623. if multigrid then
  1624. screen:expect{grid=[[
  1625. ## grid 1
  1626. [2:----------------------------------------]|
  1627. [2:----------------------------------------]|
  1628. [2:----------------------------------------]|
  1629. {5:[No Name] [+] }|
  1630. [4:----------------------------------------]|
  1631. [4:----------------------------------------]|
  1632. [4:----------------------------------------]|
  1633. {4:[No Name] [+] }|
  1634. [3:----------------------------------------]|
  1635. ## grid 2
  1636. just some |
  1637. example text |
  1638. {0:~ }|
  1639. ## grid 3
  1640. |
  1641. ## grid 4
  1642. jus^t some |
  1643. example text |
  1644. {0:~ }|
  1645. ## grid 5
  1646. {1: }|
  1647. {2:~ }|
  1648. ]], float_pos={
  1649. [5] = {{id = 1002}, "NW", 2, 1, 10, true}
  1650. }}
  1651. else
  1652. screen:expect([[
  1653. just some |
  1654. example te{1: } |
  1655. {0:~ }{2:~ }{0: }|
  1656. {5:[No Name] [+] }|
  1657. jus^t some |
  1658. example text |
  1659. {0:~ }|
  1660. {4:[No Name] [+] }|
  1661. |
  1662. ]])
  1663. end
  1664. meths.win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'})
  1665. if multigrid then
  1666. screen:expect{grid=[[
  1667. ## grid 1
  1668. [2:----------------------------------------]|
  1669. [2:----------------------------------------]|
  1670. [2:----------------------------------------]|
  1671. {5:[No Name] [+] }|
  1672. [4:----------------------------------------]|
  1673. [4:----------------------------------------]|
  1674. [4:----------------------------------------]|
  1675. {4:[No Name] [+] }|
  1676. [3:----------------------------------------]|
  1677. ## grid 2
  1678. just some |
  1679. example text |
  1680. {0:~ }|
  1681. ## grid 3
  1682. |
  1683. ## grid 4
  1684. jus^t some |
  1685. example text |
  1686. {0:~ }|
  1687. ## grid 5
  1688. {1: }|
  1689. {2:~ }|
  1690. ]], float_pos={
  1691. [5] = {{id = 1002}, "SE", 2, 3, 39, true}
  1692. }}
  1693. else
  1694. screen:expect([[
  1695. just some |
  1696. example text {1: } |
  1697. {0:~ }{2:~ }{0: }|
  1698. {5:[No Name] [+] }|
  1699. jus^t some |
  1700. example text |
  1701. {0:~ }|
  1702. {4:[No Name] [+] }|
  1703. |
  1704. ]])
  1705. end
  1706. meths.win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'})
  1707. if multigrid then
  1708. screen:expect{grid=[[
  1709. ## grid 1
  1710. [2:----------------------------------------]|
  1711. [2:----------------------------------------]|
  1712. [2:----------------------------------------]|
  1713. {5:[No Name] [+] }|
  1714. [4:----------------------------------------]|
  1715. [4:----------------------------------------]|
  1716. [4:----------------------------------------]|
  1717. {4:[No Name] [+] }|
  1718. [3:----------------------------------------]|
  1719. ## grid 2
  1720. just some |
  1721. example text |
  1722. {0:~ }|
  1723. ## grid 3
  1724. |
  1725. ## grid 4
  1726. jus^t some |
  1727. example text |
  1728. {0:~ }|
  1729. ## grid 5
  1730. {1: }|
  1731. {2:~ }|
  1732. ]], float_pos={
  1733. [5] = {{id = 1002}, "NE", 4, 0, 50, true}
  1734. }, win_viewport = {
  1735. [2] = {
  1736. topline = 0,
  1737. botline = 3,
  1738. curline = 0,
  1739. curcol = 3,
  1740. win = { id = 1000 }
  1741. },
  1742. [4] = {
  1743. topline = 0,
  1744. botline = 3,
  1745. curline = 0,
  1746. curcol = 3,
  1747. win = { id = 1001 }
  1748. },
  1749. [5] = {
  1750. topline = 0,
  1751. botline = 2,
  1752. curline = 0,
  1753. curcol = 0,
  1754. win = { id = 1002 }
  1755. }
  1756. }}
  1757. else
  1758. screen:expect([[
  1759. just some |
  1760. example text |
  1761. {0:~ }|
  1762. {5:[No Name] [+] }|
  1763. jus^t some {1: }|
  1764. example text {2:~ }|
  1765. {0:~ }|
  1766. {4:[No Name] [+] }|
  1767. |
  1768. ]])
  1769. end
  1770. end)
  1771. it('can be placed relative text in a window', function()
  1772. screen:try_resize(30,5)
  1773. local firstwin = meths.get_current_win().id
  1774. meths.buf_set_lines(0, 0, -1, true, {'just some', 'example text that is wider than the window', '', '', 'more text'})
  1775. if multigrid then
  1776. screen:expect{grid=[[
  1777. ## grid 1
  1778. [2:------------------------------]|
  1779. [2:------------------------------]|
  1780. [2:------------------------------]|
  1781. [2:------------------------------]|
  1782. [3:------------------------------]|
  1783. ## grid 2
  1784. ^just some |
  1785. example text that is wider tha|
  1786. n the window |
  1787. |
  1788. ## grid 3
  1789. |
  1790. ]]}
  1791. else
  1792. screen:expect{grid=[[
  1793. ^just some |
  1794. example text that is wider tha|
  1795. n the window |
  1796. |
  1797. |
  1798. ]]}
  1799. end
  1800. local buf = meths.create_buf(false,false)
  1801. meths.buf_set_lines(buf, 0, -1, true, {'some info!'})
  1802. local win = meths.open_win(buf, false, {relative='win', width=12, height=1, bufpos={1,32}})
  1803. if multigrid then
  1804. screen:expect{grid=[[
  1805. ## grid 1
  1806. [2:------------------------------]|
  1807. [2:------------------------------]|
  1808. [2:------------------------------]|
  1809. [2:------------------------------]|
  1810. [3:------------------------------]|
  1811. ## grid 2
  1812. ^just some |
  1813. example text that is wider tha|
  1814. n the window |
  1815. |
  1816. ## grid 3
  1817. |
  1818. ## grid 5
  1819. {1:some info! }|
  1820. ]], float_pos={
  1821. [5] = { {
  1822. id = 1002
  1823. }, "NW", 2, 3, 2, true }
  1824. }}
  1825. else
  1826. screen:expect{grid=[[
  1827. ^just some |
  1828. example text that is wider tha|
  1829. n the window |
  1830. {1:some info! } |
  1831. |
  1832. ]]}
  1833. end
  1834. eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW',
  1835. external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, meths.win_get_config(win))
  1836. feed('<c-e>')
  1837. if multigrid then
  1838. screen:expect{grid=[[
  1839. ## grid 1
  1840. [2:------------------------------]|
  1841. [2:------------------------------]|
  1842. [2:------------------------------]|
  1843. [2:------------------------------]|
  1844. [3:------------------------------]|
  1845. ## grid 2
  1846. ^example text that is wider tha|
  1847. n the window |
  1848. |
  1849. |
  1850. ## grid 3
  1851. |
  1852. ## grid 5
  1853. {1:some info! }|
  1854. ]], float_pos={
  1855. [5] = { {
  1856. id = 1002
  1857. }, "NW", 2, 2, 2, true }
  1858. }}
  1859. else
  1860. screen:expect{grid=[[
  1861. ^example text that is wider tha|
  1862. n the window |
  1863. {1:some info! } |
  1864. |
  1865. |
  1866. ]]}
  1867. end
  1868. screen:try_resize(45,5)
  1869. if multigrid then
  1870. screen:expect{grid=[[
  1871. ## grid 1
  1872. [2:---------------------------------------------]|
  1873. [2:---------------------------------------------]|
  1874. [2:---------------------------------------------]|
  1875. [2:---------------------------------------------]|
  1876. [3:---------------------------------------------]|
  1877. ## grid 2
  1878. ^example text that is wider than the window |
  1879. |
  1880. |
  1881. more text |
  1882. ## grid 3
  1883. |
  1884. ## grid 5
  1885. {1:some info! }|
  1886. ]], float_pos={
  1887. [5] = { {
  1888. id = 1002
  1889. }, "NW", 2, 1, 32, true }
  1890. }}
  1891. else
  1892. -- note: appears misalinged due to cursor
  1893. screen:expect{grid=[[
  1894. ^example text that is wider than the window |
  1895. {1:some info! } |
  1896. |
  1897. more text |
  1898. |
  1899. ]]}
  1900. end
  1901. screen:try_resize(25,10)
  1902. if multigrid then
  1903. screen:expect{grid=[[
  1904. ## grid 1
  1905. [2:-------------------------]|
  1906. [2:-------------------------]|
  1907. [2:-------------------------]|
  1908. [2:-------------------------]|
  1909. [2:-------------------------]|
  1910. [2:-------------------------]|
  1911. [2:-------------------------]|
  1912. [2:-------------------------]|
  1913. [2:-------------------------]|
  1914. [3:-------------------------]|
  1915. ## grid 2
  1916. ^example text that is wide|
  1917. r than the window |
  1918. |
  1919. |
  1920. more text |
  1921. {0:~ }|
  1922. {0:~ }|
  1923. {0:~ }|
  1924. {0:~ }|
  1925. ## grid 3
  1926. |
  1927. ## grid 5
  1928. {1:some info! }|
  1929. ]], float_pos={
  1930. [5] = { {
  1931. id = 1002
  1932. }, "NW", 2, 2, 7, true }
  1933. }}
  1934. else
  1935. screen:expect{grid=[[
  1936. ^example text that is wide|
  1937. r than the window |
  1938. {1:some info! } |
  1939. |
  1940. more text |
  1941. {0:~ }|
  1942. {0:~ }|
  1943. {0:~ }|
  1944. {0:~ }|
  1945. |
  1946. ]]}
  1947. end
  1948. meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='SW'})
  1949. if multigrid then
  1950. screen:expect{grid=[[
  1951. ## grid 1
  1952. [2:-------------------------]|
  1953. [2:-------------------------]|
  1954. [2:-------------------------]|
  1955. [2:-------------------------]|
  1956. [2:-------------------------]|
  1957. [2:-------------------------]|
  1958. [2:-------------------------]|
  1959. [2:-------------------------]|
  1960. [2:-------------------------]|
  1961. [3:-------------------------]|
  1962. ## grid 2
  1963. ^example text that is wide|
  1964. r than the window |
  1965. |
  1966. |
  1967. more text |
  1968. {0:~ }|
  1969. {0:~ }|
  1970. {0:~ }|
  1971. {0:~ }|
  1972. ## grid 3
  1973. |
  1974. ## grid 5
  1975. {1:some info! }|
  1976. ]], float_pos={
  1977. [5] = { {
  1978. id = 1002
  1979. }, "SW", 2, 1, 7, true }
  1980. }}
  1981. else
  1982. screen:expect{grid=[[
  1983. ^example{1:some info! }s wide|
  1984. r than the window |
  1985. |
  1986. |
  1987. more text |
  1988. {0:~ }|
  1989. {0:~ }|
  1990. {0:~ }|
  1991. {0:~ }|
  1992. |
  1993. ]]}
  1994. end
  1995. meths.win_set_config(win, {relative='win', bufpos={1,32}, anchor='NW', col=-2})
  1996. if multigrid then
  1997. screen:expect{grid=[[
  1998. ## grid 1
  1999. [2:-------------------------]|
  2000. [2:-------------------------]|
  2001. [2:-------------------------]|
  2002. [2:-------------------------]|
  2003. [2:-------------------------]|
  2004. [2:-------------------------]|
  2005. [2:-------------------------]|
  2006. [2:-------------------------]|
  2007. [2:-------------------------]|
  2008. [3:-------------------------]|
  2009. ## grid 2
  2010. ^example text that is wide|
  2011. r than the window |
  2012. |
  2013. |
  2014. more text |
  2015. {0:~ }|
  2016. {0:~ }|
  2017. {0:~ }|
  2018. {0:~ }|
  2019. ## grid 3
  2020. |
  2021. ## grid 5
  2022. {1:some info! }|
  2023. ]], float_pos={
  2024. [5] = { {
  2025. id = 1002
  2026. }, "NW", 2, 2, 5, true }
  2027. }}
  2028. else
  2029. screen:expect{grid=[[
  2030. ^example text that is wide|
  2031. r than the window |
  2032. {1:some info! } |
  2033. |
  2034. more text |
  2035. {0:~ }|
  2036. {0:~ }|
  2037. {0:~ }|
  2038. {0:~ }|
  2039. |
  2040. ]]}
  2041. end
  2042. meths.win_set_config(win, {relative='win', bufpos={1,32}, row=2})
  2043. if multigrid then
  2044. screen:expect{grid=[[
  2045. ## grid 1
  2046. [2:-------------------------]|
  2047. [2:-------------------------]|
  2048. [2:-------------------------]|
  2049. [2:-------------------------]|
  2050. [2:-------------------------]|
  2051. [2:-------------------------]|
  2052. [2:-------------------------]|
  2053. [2:-------------------------]|
  2054. [2:-------------------------]|
  2055. [3:-------------------------]|
  2056. ## grid 2
  2057. ^example text that is wide|
  2058. r than the window |
  2059. |
  2060. |
  2061. more text |
  2062. {0:~ }|
  2063. {0:~ }|
  2064. {0:~ }|
  2065. {0:~ }|
  2066. ## grid 3
  2067. |
  2068. ## grid 5
  2069. {1:some info! }|
  2070. ]], float_pos={
  2071. [5] = { {
  2072. id = 1002
  2073. }, "NW", 2, 3, 7, true }
  2074. }}
  2075. else
  2076. screen:expect{grid=[[
  2077. ^example text that is wide|
  2078. r than the window |
  2079. |
  2080. {1:some info! } |
  2081. more text |
  2082. {0:~ }|
  2083. {0:~ }|
  2084. {0:~ }|
  2085. {0:~ }|
  2086. |
  2087. ]]}
  2088. end
  2089. end)
  2090. it('validates cursor even when window is not entered', function()
  2091. screen:try_resize(30,5)
  2092. command("set nowrap")
  2093. insert([[some text that is wider than the window]])
  2094. if multigrid then
  2095. screen:expect([[
  2096. ## grid 1
  2097. [2:------------------------------]|
  2098. [2:------------------------------]|
  2099. [2:------------------------------]|
  2100. [2:------------------------------]|
  2101. [3:------------------------------]|
  2102. ## grid 2
  2103. that is wider than the windo^w |
  2104. {0:~ }|
  2105. {0:~ }|
  2106. {0:~ }|
  2107. ## grid 3
  2108. |
  2109. ]])
  2110. else
  2111. screen:expect([[
  2112. that is wider than the windo^w |
  2113. {0:~ }|
  2114. {0:~ }|
  2115. {0:~ }|
  2116. |
  2117. ]])
  2118. end
  2119. local buf = meths.create_buf(false,true)
  2120. meths.buf_set_lines(buf, 0, -1, true, {'some floaty text'})
  2121. meths.open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1})
  2122. if multigrid then
  2123. screen:expect{grid=[[
  2124. ## grid 1
  2125. [2:------------------------------]|
  2126. [2:------------------------------]|
  2127. [2:------------------------------]|
  2128. [2:------------------------------]|
  2129. [3:------------------------------]|
  2130. ## grid 2
  2131. that is wider than the windo^w |
  2132. {0:~ }|
  2133. {0:~ }|
  2134. {0:~ }|
  2135. ## grid 3
  2136. |
  2137. ## grid 5
  2138. {1:some floaty text }|
  2139. ]], float_pos={
  2140. [5] = {{id = 1002}, "NW", 1, 3, 1, true}
  2141. }}
  2142. else
  2143. screen:expect([[
  2144. that is wider than the windo^w |
  2145. {0:~ }|
  2146. {0:~ }|
  2147. {0:~}{1:some floaty text }{0: }|
  2148. |
  2149. ]])
  2150. end
  2151. end)
  2152. if multigrid then
  2153. pending("supports second UI without multigrid", function()
  2154. local session2 = helpers.connect(eval('v:servername'))
  2155. print(session2:request("nvim_eval", "2+2"))
  2156. local screen2 = Screen.new(40,7)
  2157. screen2:attach(nil, session2)
  2158. screen2:set_default_attr_ids(attrs)
  2159. local buf = meths.create_buf(false,false)
  2160. meths.open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5})
  2161. local expected_pos = {
  2162. [2]={{id=1001}, 'NW', 1, 2, 5}
  2163. }
  2164. screen:expect{grid=[[
  2165. ## grid 1
  2166. |
  2167. {0:~ }|
  2168. {0:~ }|
  2169. {0:~ }|
  2170. {0:~ }|
  2171. {0:~ }|
  2172. |
  2173. ## grid 2
  2174. {1:^ }|
  2175. {2:~ }|
  2176. ]], float_pos=expected_pos}
  2177. screen2:expect([[
  2178. |
  2179. {0:~ }|
  2180. {0:~ }{1:^ }{0: }|
  2181. {0:~ }{2:~ }{0: }|
  2182. {0:~ }|
  2183. {0:~ }|
  2184. |
  2185. ]])
  2186. end)
  2187. end
  2188. it('handles resized screen', function()
  2189. local buf = meths.create_buf(false,false)
  2190. meths.buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'})
  2191. local win = meths.open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10})
  2192. local expected_pos = {
  2193. [5]={{id=1002}, 'NW', 1, 2, 10, true},
  2194. }
  2195. if multigrid then
  2196. screen:expect{grid=[[
  2197. ## grid 1
  2198. [2:----------------------------------------]|
  2199. [2:----------------------------------------]|
  2200. [2:----------------------------------------]|
  2201. [2:----------------------------------------]|
  2202. [2:----------------------------------------]|
  2203. [2:----------------------------------------]|
  2204. [3:----------------------------------------]|
  2205. ## grid 2
  2206. ^ |
  2207. {0:~ }|
  2208. {0:~ }|
  2209. {0:~ }|
  2210. {0:~ }|
  2211. {0:~ }|
  2212. ## grid 3
  2213. |
  2214. ## grid 5
  2215. {1:such }|
  2216. {1:very }|
  2217. {1:float }|
  2218. {2:~ }|
  2219. ]], float_pos=expected_pos}
  2220. else
  2221. screen:expect([[
  2222. ^ |
  2223. {0:~ }|
  2224. {0:~ }{1:such }{0: }|
  2225. {0:~ }{1:very }{0: }|
  2226. {0:~ }{1:float }{0: }|
  2227. {0:~ }{2:~ }{0: }|
  2228. |
  2229. ]])
  2230. end
  2231. screen:try_resize(40,5)
  2232. if multigrid then
  2233. screen:expect{grid=[[
  2234. ## grid 1
  2235. [2:----------------------------------------]|
  2236. [2:----------------------------------------]|
  2237. [2:----------------------------------------]|
  2238. [2:----------------------------------------]|
  2239. [3:----------------------------------------]|
  2240. ## grid 2
  2241. ^ |
  2242. {0:~ }|
  2243. {0:~ }|
  2244. {0:~ }|
  2245. ## grid 3
  2246. |
  2247. ## grid 5
  2248. {1:such }|
  2249. {1:very }|
  2250. {1:float }|
  2251. {2:~ }|
  2252. ]], float_pos=expected_pos}
  2253. else
  2254. screen:expect([[
  2255. ^ {1:such } |
  2256. {0:~ }{1:very }{0: }|
  2257. {0:~ }{1:float }{0: }|
  2258. {0:~ }{2:~ }{0: }|
  2259. |
  2260. ]])
  2261. end
  2262. screen:try_resize(40,4)
  2263. if multigrid then
  2264. screen:expect{grid=[[
  2265. ## grid 1
  2266. [2:----------------------------------------]|
  2267. [2:----------------------------------------]|
  2268. [2:----------------------------------------]|
  2269. [3:----------------------------------------]|
  2270. ## grid 2
  2271. ^ |
  2272. {0:~ }|
  2273. {0:~ }|
  2274. ## grid 3
  2275. |
  2276. ## grid 5
  2277. {1:such }|
  2278. {1:very }|
  2279. {1:float }|
  2280. {2:~ }|
  2281. ]], float_pos=expected_pos}
  2282. else
  2283. screen:expect([[
  2284. ^ {1:such } |
  2285. {0:~ }{1:very }{0: }|
  2286. {0:~ }{1:float }{0: }|
  2287. |
  2288. ]])
  2289. end
  2290. screen:try_resize(40,3)
  2291. if multigrid then
  2292. screen:expect{grid=[[
  2293. ## grid 1
  2294. [2:----------------------------------------]|
  2295. [2:----------------------------------------]|
  2296. [3:----------------------------------------]|
  2297. ## grid 2
  2298. ^ |
  2299. {0:~ }|
  2300. ## grid 3
  2301. |
  2302. ## grid 5
  2303. {1:such }|
  2304. {1:very }|
  2305. {1:float }|
  2306. {2:~ }|
  2307. ]], float_pos=expected_pos}
  2308. else
  2309. screen:expect([[
  2310. ^ {1:such } |
  2311. {0:~ }{1:very }{0: }|
  2312. |
  2313. ]])
  2314. end
  2315. feed('<c-w>wjj')
  2316. if multigrid then
  2317. screen:expect{grid=[[
  2318. ## grid 1
  2319. [2:----------------------------------------]|
  2320. [2:----------------------------------------]|
  2321. [3:----------------------------------------]|
  2322. ## grid 2
  2323. |
  2324. {0:~ }|
  2325. ## grid 3
  2326. |
  2327. ## grid 5
  2328. {1:such }|
  2329. {1:very }|
  2330. {1:^float }|
  2331. {2:~ }|
  2332. ]], float_pos=expected_pos}
  2333. else
  2334. screen:expect([[
  2335. {1:very } |
  2336. {0:~ }{1:^float }{0: }|
  2337. |
  2338. ]])
  2339. end
  2340. screen:try_resize(40,7)
  2341. if multigrid then
  2342. screen:expect{grid=[[
  2343. ## grid 1
  2344. [2:----------------------------------------]|
  2345. [2:----------------------------------------]|
  2346. [2:----------------------------------------]|
  2347. [2:----------------------------------------]|
  2348. [2:----------------------------------------]|
  2349. [2:----------------------------------------]|
  2350. [3:----------------------------------------]|
  2351. ## grid 2
  2352. |
  2353. {0:~ }|
  2354. {0:~ }|
  2355. {0:~ }|
  2356. {0:~ }|
  2357. {0:~ }|
  2358. ## grid 3
  2359. |
  2360. ## grid 5
  2361. {1:such }|
  2362. {1:very }|
  2363. {1:^float }|
  2364. {2:~ }|
  2365. ]], float_pos=expected_pos}
  2366. else
  2367. screen:expect([[
  2368. |
  2369. {0:~ }|
  2370. {0:~ }{1:such }{0: }|
  2371. {0:~ }{1:very }{0: }|
  2372. {0:~ }{1:^float }{0: }|
  2373. {0:~ }{2:~ }{0: }|
  2374. |
  2375. ]])
  2376. end
  2377. meths.win_set_config(win, {height=3})
  2378. feed('gg')
  2379. if multigrid then
  2380. screen:expect{grid=[[
  2381. ## grid 1
  2382. [2:----------------------------------------]|
  2383. [2:----------------------------------------]|
  2384. [2:----------------------------------------]|
  2385. [2:----------------------------------------]|
  2386. [2:----------------------------------------]|
  2387. [2:----------------------------------------]|
  2388. [3:----------------------------------------]|
  2389. ## grid 2
  2390. |
  2391. {0:~ }|
  2392. {0:~ }|
  2393. {0:~ }|
  2394. {0:~ }|
  2395. {0:~ }|
  2396. ## grid 3
  2397. |
  2398. ## grid 5
  2399. {1:^such }|
  2400. {1:very }|
  2401. {1:float }|
  2402. ]], float_pos=expected_pos}
  2403. else
  2404. screen:expect([[
  2405. |
  2406. {0:~ }|
  2407. {0:~ }{1:^such }{0: }|
  2408. {0:~ }{1:very }{0: }|
  2409. {0:~ }{1:float }{0: }|
  2410. {0:~ }|
  2411. |
  2412. ]])
  2413. end
  2414. screen:try_resize(26,7)
  2415. if multigrid then
  2416. screen:expect{grid=[[
  2417. ## grid 1
  2418. [2:--------------------------]|
  2419. [2:--------------------------]|
  2420. [2:--------------------------]|
  2421. [2:--------------------------]|
  2422. [2:--------------------------]|
  2423. [2:--------------------------]|
  2424. [3:--------------------------]|
  2425. ## grid 2
  2426. |
  2427. {0:~ }|
  2428. {0:~ }|
  2429. {0:~ }|
  2430. {0:~ }|
  2431. {0:~ }|
  2432. ## grid 3
  2433. |
  2434. ## grid 5
  2435. {1:^such }|
  2436. {1:very }|
  2437. {1:float }|
  2438. ]], float_pos=expected_pos}
  2439. else
  2440. screen:expect([[
  2441. |
  2442. {0:~ }|
  2443. {0:~ }{1:^such }{0: }|
  2444. {0:~ }{1:very }{0: }|
  2445. {0:~ }{1:float }{0: }|
  2446. {0:~ }|
  2447. |
  2448. ]])
  2449. end
  2450. screen:try_resize(25,7)
  2451. if multigrid then
  2452. screen:expect{grid=[[
  2453. ## grid 1
  2454. [2:-------------------------]|
  2455. [2:-------------------------]|
  2456. [2:-------------------------]|
  2457. [2:-------------------------]|
  2458. [2:-------------------------]|
  2459. [2:-------------------------]|
  2460. [3:-------------------------]|
  2461. ## grid 2
  2462. |
  2463. {0:~ }|
  2464. {0:~ }|
  2465. {0:~ }|
  2466. {0:~ }|
  2467. {0:~ }|
  2468. ## grid 3
  2469. |
  2470. ## grid 5
  2471. {1:^such }|
  2472. {1:very }|
  2473. {1:float }|
  2474. ]], float_pos=expected_pos}
  2475. else
  2476. screen:expect([[
  2477. |
  2478. {0:~ }|
  2479. {0:~ }{1:^such }|
  2480. {0:~ }{1:very }|
  2481. {0:~ }{1:float }|
  2482. {0:~ }|
  2483. |
  2484. ]])
  2485. end
  2486. screen:try_resize(24,7)
  2487. if multigrid then
  2488. screen:expect{grid=[[
  2489. ## grid 1
  2490. [2:------------------------]|
  2491. [2:------------------------]|
  2492. [2:------------------------]|
  2493. [2:------------------------]|
  2494. [2:------------------------]|
  2495. [2:------------------------]|
  2496. [3:------------------------]|
  2497. ## grid 2
  2498. |
  2499. {0:~ }|
  2500. {0:~ }|
  2501. {0:~ }|
  2502. {0:~ }|
  2503. {0:~ }|
  2504. ## grid 3
  2505. |
  2506. ## grid 5
  2507. {1:^such }|
  2508. {1:very }|
  2509. {1:float }|
  2510. ]], float_pos=expected_pos}
  2511. else
  2512. screen:expect([[
  2513. |
  2514. {0:~ }|
  2515. {0:~ }{1:^such }|
  2516. {0:~ }{1:very }|
  2517. {0:~ }{1:float }|
  2518. {0:~ }|
  2519. |
  2520. ]])
  2521. end
  2522. screen:try_resize(16,7)
  2523. if multigrid then
  2524. screen:expect{grid=[[
  2525. ## grid 1
  2526. [2:----------------]|
  2527. [2:----------------]|
  2528. [2:----------------]|
  2529. [2:----------------]|
  2530. [2:----------------]|
  2531. [2:----------------]|
  2532. [3:----------------]|
  2533. ## grid 2
  2534. |
  2535. {0:~ }|
  2536. {0:~ }|
  2537. {0:~ }|
  2538. {0:~ }|
  2539. {0:~ }|
  2540. ## grid 3
  2541. |
  2542. ## grid 5
  2543. {1:^such }|
  2544. {1:very }|
  2545. {1:float }|
  2546. ]], float_pos=expected_pos}
  2547. else
  2548. screen:expect([[
  2549. |
  2550. {0:~ }|
  2551. {0:~}{1:^such }|
  2552. {0:~}{1:very }|
  2553. {0:~}{1:float }|
  2554. {0:~ }|
  2555. |
  2556. ]])
  2557. end
  2558. screen:try_resize(15,7)
  2559. if multigrid then
  2560. screen:expect{grid=[[
  2561. ## grid 1
  2562. [2:---------------]|
  2563. [2:---------------]|
  2564. [2:---------------]|
  2565. [2:---------------]|
  2566. [2:---------------]|
  2567. [2:---------------]|
  2568. [3:---------------]|
  2569. ## grid 2
  2570. |
  2571. {0:~ }|
  2572. {0:~ }|
  2573. {0:~ }|
  2574. {0:~ }|
  2575. {0:~ }|
  2576. ## grid 3
  2577. |
  2578. ## grid 5
  2579. {1:^such }|
  2580. {1:very }|
  2581. {1:float }|
  2582. ]], float_pos=expected_pos}
  2583. else
  2584. screen:expect([[
  2585. |
  2586. {0:~ }|
  2587. {1:^such }|
  2588. {1:very }|
  2589. {1:float }|
  2590. {0:~ }|
  2591. |
  2592. ]])
  2593. end
  2594. screen:try_resize(14,7)
  2595. if multigrid then
  2596. screen:expect{grid=[[
  2597. ## grid 1
  2598. [2:--------------]|
  2599. [2:--------------]|
  2600. [2:--------------]|
  2601. [2:--------------]|
  2602. [2:--------------]|
  2603. [2:--------------]|
  2604. [3:--------------]|
  2605. ## grid 2
  2606. |
  2607. {0:~ }|
  2608. {0:~ }|
  2609. {0:~ }|
  2610. {0:~ }|
  2611. {0:~ }|
  2612. ## grid 3
  2613. |
  2614. ## grid 5
  2615. {1:^such }|
  2616. {1:very }|
  2617. {1:float }|
  2618. ]], float_pos=expected_pos}
  2619. else
  2620. screen:expect([[
  2621. |
  2622. {0:~ }|
  2623. {1:^such }|
  2624. {1:very }|
  2625. {1:float }|
  2626. {0:~ }|
  2627. |
  2628. ]])
  2629. end
  2630. screen:try_resize(12,7)
  2631. if multigrid then
  2632. screen:expect{grid=[[
  2633. ## grid 1
  2634. [2:------------]|
  2635. [2:------------]|
  2636. [2:------------]|
  2637. [2:------------]|
  2638. [2:------------]|
  2639. [2:------------]|
  2640. [3:------------]|
  2641. ## grid 2
  2642. |
  2643. {0:~ }|
  2644. {0:~ }|
  2645. {0:~ }|
  2646. {0:~ }|
  2647. {0:~ }|
  2648. ## grid 3
  2649. |
  2650. ## grid 5
  2651. {1:^such }|
  2652. {1:very }|
  2653. {1:float }|
  2654. ]], float_pos=expected_pos}
  2655. else
  2656. screen:expect([[
  2657. |
  2658. {0:~ }|
  2659. {1:^such }|
  2660. {1:very }|
  2661. {1:float }|
  2662. {0:~ }|
  2663. |
  2664. ]])
  2665. end
  2666. -- Doesn't make much sense, but check nvim doesn't crash
  2667. screen:try_resize(1,1)
  2668. if multigrid then
  2669. screen:expect{grid=[[
  2670. ## grid 1
  2671. [2:------------]|
  2672. [3:------------]|
  2673. ## grid 2
  2674. |
  2675. ## grid 3
  2676. |
  2677. ## grid 5
  2678. {1:^such }|
  2679. {1:very }|
  2680. {1:float }|
  2681. ]], float_pos=expected_pos}
  2682. else
  2683. screen:expect([[
  2684. {1:^such }|
  2685. |
  2686. ]])
  2687. end
  2688. screen:try_resize(40,7)
  2689. if multigrid then
  2690. screen:expect{grid=[[
  2691. ## grid 1
  2692. [2:----------------------------------------]|
  2693. [2:----------------------------------------]|
  2694. [2:----------------------------------------]|
  2695. [2:----------------------------------------]|
  2696. [2:----------------------------------------]|
  2697. [2:----------------------------------------]|
  2698. [3:----------------------------------------]|
  2699. ## grid 2
  2700. |
  2701. {0:~ }|
  2702. {0:~ }|
  2703. {0:~ }|
  2704. {0:~ }|
  2705. {0:~ }|
  2706. ## grid 3
  2707. |
  2708. ## grid 5
  2709. {1:^such }|
  2710. {1:very }|
  2711. {1:float }|
  2712. ]], float_pos=expected_pos}
  2713. else
  2714. screen:expect([[
  2715. |
  2716. {0:~ }|
  2717. {0:~ }{1:^such }{0: }|
  2718. {0:~ }{1:very }{0: }|
  2719. {0:~ }{1:float }{0: }|
  2720. {0:~ }|
  2721. |
  2722. ]])
  2723. end
  2724. end)
  2725. it('does not crash with inccommand #9379', function()
  2726. local expected_pos = {
  2727. [4]={{id=1001}, 'NW', 1, 2, 0, true},
  2728. }
  2729. command("set inccommand=split")
  2730. command("set laststatus=2")
  2731. local buf = meths.create_buf(false,false)
  2732. meths.open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0})
  2733. insert([[
  2734. foo
  2735. bar
  2736. ]])
  2737. if multigrid then
  2738. screen:expect{grid=[[
  2739. ## grid 1
  2740. [2:----------------------------------------]|
  2741. [2:----------------------------------------]|
  2742. [2:----------------------------------------]|
  2743. [2:----------------------------------------]|
  2744. [2:----------------------------------------]|
  2745. {5:[No Name] }|
  2746. [3:----------------------------------------]|
  2747. ## grid 2
  2748. |
  2749. {0:~ }|
  2750. {0:~ }|
  2751. {0:~ }|
  2752. {0:~ }|
  2753. ## grid 3
  2754. |
  2755. ## grid 4
  2756. {1:foo }|
  2757. {1:bar }|
  2758. {1:^ }|
  2759. ]], float_pos=expected_pos}
  2760. else
  2761. screen:expect([[
  2762. |
  2763. {0:~ }|
  2764. {1:foo }{0: }|
  2765. {1:bar }{0: }|
  2766. {1:^ }{0: }|
  2767. {5:[No Name] }|
  2768. |
  2769. ]])
  2770. end
  2771. feed(':%s/.')
  2772. if multigrid then
  2773. screen:expect{grid=[[
  2774. ## grid 1
  2775. [2:----------------------------------------]|
  2776. {5:[No Name] }|
  2777. [5:----------------------------------------]|
  2778. [5:----------------------------------------]|
  2779. [5:----------------------------------------]|
  2780. {5:[Preview] }|
  2781. [3:----------------------------------------]|
  2782. ## grid 2
  2783. |
  2784. ## grid 3
  2785. :%s/.^ |
  2786. ## grid 4
  2787. {17:f}{1:oo }|
  2788. {17:b}{1:ar }|
  2789. {1: }|
  2790. ## grid 5
  2791. |1| {17:f}oo |
  2792. |2| {17:b}ar |
  2793. {0:~ }|
  2794. ]], float_pos=expected_pos}
  2795. else
  2796. screen:expect([[
  2797. |
  2798. {5:[No Name] }|
  2799. {17:f}{1:oo } |
  2800. {17:b}{1:ar } |
  2801. {1: }{0: }|
  2802. {5:[Preview] }|
  2803. :%s/.^ |
  2804. ]])
  2805. end
  2806. feed('<Esc>')
  2807. if multigrid then
  2808. screen:expect{grid=[[
  2809. ## grid 1
  2810. [2:----------------------------------------]|
  2811. [2:----------------------------------------]|
  2812. [2:----------------------------------------]|
  2813. [2:----------------------------------------]|
  2814. [2:----------------------------------------]|
  2815. {5:[No Name] }|
  2816. [3:----------------------------------------]|
  2817. ## grid 2
  2818. |
  2819. {0:~ }|
  2820. {0:~ }|
  2821. {0:~ }|
  2822. {0:~ }|
  2823. ## grid 3
  2824. |
  2825. ## grid 4
  2826. {1:foo }|
  2827. {1:bar }|
  2828. {1:^ }|
  2829. ]], float_pos=expected_pos}
  2830. else
  2831. screen:expect([[
  2832. |
  2833. {0:~ }|
  2834. {1:foo }{0: }|
  2835. {1:bar }{0: }|
  2836. {1:^ }{0: }|
  2837. {5:[No Name] }|
  2838. |
  2839. ]])
  2840. end
  2841. end)
  2842. it('does not crash when set cmdheight #9680', function()
  2843. local buf = meths.create_buf(false,false)
  2844. meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  2845. command("set cmdheight=2")
  2846. eq(1, meths.eval('1'))
  2847. end)
  2848. describe('and completion', function()
  2849. before_each(function()
  2850. local buf = meths.create_buf(false,false)
  2851. local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5})
  2852. meths.win_set_option(win , 'winhl', 'Normal:ErrorMsg')
  2853. if multigrid then
  2854. screen:expect{grid=[[
  2855. ## grid 1
  2856. [2:----------------------------------------]|
  2857. [2:----------------------------------------]|
  2858. [2:----------------------------------------]|
  2859. [2:----------------------------------------]|
  2860. [2:----------------------------------------]|
  2861. [2:----------------------------------------]|
  2862. [3:----------------------------------------]|
  2863. ## grid 2
  2864. |
  2865. {0:~ }|
  2866. {0:~ }|
  2867. {0:~ }|
  2868. {0:~ }|
  2869. {0:~ }|
  2870. ## grid 3
  2871. |
  2872. ## grid 4
  2873. {7:^ }|
  2874. {12:~ }|
  2875. {12:~ }|
  2876. {12:~ }|
  2877. ]], float_pos={
  2878. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  2879. }}
  2880. else
  2881. screen:expect([[
  2882. |
  2883. {0:~ }|
  2884. {0:~ }{7:^ }{0: }|
  2885. {0:~ }{12:~ }{0: }|
  2886. {0:~ }{12:~ }{0: }|
  2887. {0:~ }{12:~ }{0: }|
  2888. |
  2889. ]])
  2890. end
  2891. end)
  2892. it('with builtin popupmenu', function()
  2893. feed('ix ')
  2894. funcs.complete(3, {'aa', 'word', 'longtext'})
  2895. if multigrid then
  2896. screen:expect{grid=[[
  2897. ## grid 1
  2898. [2:----------------------------------------]|
  2899. [2:----------------------------------------]|
  2900. [2:----------------------------------------]|
  2901. [2:----------------------------------------]|
  2902. [2:----------------------------------------]|
  2903. [2:----------------------------------------]|
  2904. [3:----------------------------------------]|
  2905. ## grid 2
  2906. |
  2907. {0:~ }|
  2908. {0:~ }|
  2909. {0:~ }|
  2910. {0:~ }|
  2911. {0:~ }|
  2912. ## grid 3
  2913. {3:-- INSERT --} |
  2914. ## grid 4
  2915. {7:x aa^ }|
  2916. {12:~ }|
  2917. {12:~ }|
  2918. {12:~ }|
  2919. ## grid 5
  2920. {13: aa }|
  2921. {1: word }|
  2922. {1: longtext }|
  2923. ]], float_pos={
  2924. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true, 50},
  2925. [5] = {{ id = -1 }, "NW", 4, 1, 1, false, 100}
  2926. }}
  2927. else
  2928. screen:expect([[
  2929. |
  2930. {0:~ }|
  2931. {0:~ }{7:x aa^ }{0: }|
  2932. {0:~ }{12:~}{13: aa }{0: }|
  2933. {0:~ }{12:~}{1: word }{0: }|
  2934. {0:~ }{12:~}{1: longtext }{0: }|
  2935. {3:-- INSERT --} |
  2936. ]])
  2937. end
  2938. feed('<esc>')
  2939. if multigrid then
  2940. screen:expect{grid=[[
  2941. ## grid 1
  2942. [2:----------------------------------------]|
  2943. [2:----------------------------------------]|
  2944. [2:----------------------------------------]|
  2945. [2:----------------------------------------]|
  2946. [2:----------------------------------------]|
  2947. [2:----------------------------------------]|
  2948. [3:----------------------------------------]|
  2949. ## grid 2
  2950. |
  2951. {0:~ }|
  2952. {0:~ }|
  2953. {0:~ }|
  2954. {0:~ }|
  2955. {0:~ }|
  2956. ## grid 3
  2957. |
  2958. ## grid 4
  2959. {7:x a^a }|
  2960. {12:~ }|
  2961. {12:~ }|
  2962. {12:~ }|
  2963. ]], float_pos={
  2964. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  2965. }}
  2966. else
  2967. screen:expect([[
  2968. |
  2969. {0:~ }|
  2970. {0:~ }{7:x a^a }{0: }|
  2971. {0:~ }{12:~ }{0: }|
  2972. {0:~ }{12:~ }{0: }|
  2973. {0:~ }{12:~ }{0: }|
  2974. |
  2975. ]])
  2976. end
  2977. feed('<c-w>wi')
  2978. funcs.complete(1, {'xx', 'yy', 'zz'})
  2979. if multigrid then
  2980. screen:expect{grid=[[
  2981. ## grid 1
  2982. [2:----------------------------------------]|
  2983. [2:----------------------------------------]|
  2984. [2:----------------------------------------]|
  2985. [2:----------------------------------------]|
  2986. [2:----------------------------------------]|
  2987. [2:----------------------------------------]|
  2988. [3:----------------------------------------]|
  2989. ## grid 2
  2990. xx^ |
  2991. {0:~ }|
  2992. {0:~ }|
  2993. {0:~ }|
  2994. {0:~ }|
  2995. {0:~ }|
  2996. ## grid 3
  2997. {3:-- INSERT --} |
  2998. ## grid 4
  2999. {7:x aa }|
  3000. {12:~ }|
  3001. {12:~ }|
  3002. {12:~ }|
  3003. ## grid 5
  3004. {13:xx }|
  3005. {1:yy }|
  3006. {1:zz }|
  3007. ]], float_pos={
  3008. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true, 50},
  3009. [5] = {{ id = -1 }, "NW", 2, 1, 0, false, 100}
  3010. }}
  3011. else
  3012. screen:expect([[
  3013. xx^ |
  3014. {13:xx }{0: }|
  3015. {1:yy }{7: }{0: }|
  3016. {1:zz }{12: }{0: }|
  3017. {0:~ }{12:~ }{0: }|
  3018. {0:~ }{12:~ }{0: }|
  3019. {3:-- INSERT --} |
  3020. ]])
  3021. end
  3022. feed('<c-y>')
  3023. if multigrid then
  3024. screen:expect{grid=[[
  3025. ## grid 1
  3026. [2:----------------------------------------]|
  3027. [2:----------------------------------------]|
  3028. [2:----------------------------------------]|
  3029. [2:----------------------------------------]|
  3030. [2:----------------------------------------]|
  3031. [2:----------------------------------------]|
  3032. [3:----------------------------------------]|
  3033. ## grid 2
  3034. xx^ |
  3035. {0:~ }|
  3036. {0:~ }|
  3037. {0:~ }|
  3038. {0:~ }|
  3039. {0:~ }|
  3040. ## grid 3
  3041. {3:-- INSERT --} |
  3042. ## grid 4
  3043. {7:x aa }|
  3044. {12:~ }|
  3045. {12:~ }|
  3046. {12:~ }|
  3047. ]], float_pos={
  3048. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  3049. }}
  3050. else
  3051. screen:expect([[
  3052. xx^ |
  3053. {0:~ }|
  3054. {0:~ }{7:x aa }{0: }|
  3055. {0:~ }{12:~ }{0: }|
  3056. {0:~ }{12:~ }{0: }|
  3057. {0:~ }{12:~ }{0: }|
  3058. {3:-- INSERT --} |
  3059. ]])
  3060. end
  3061. end)
  3062. it('command menu rendered above cursor (pum_above)', function()
  3063. command('set wildmenu wildmode=longest:full wildoptions=pum')
  3064. feed(':sign u<tab>')
  3065. if multigrid then
  3066. screen:expect{grid=[[
  3067. ## grid 1
  3068. [2:----------------------------------------]|
  3069. [2:----------------------------------------]|
  3070. [2:----------------------------------------]|
  3071. [2:----------------------------------------]|
  3072. [2:----------------------------------------]|
  3073. [2:----------------------------------------]|
  3074. [3:----------------------------------------]|
  3075. ## grid 2
  3076. |
  3077. {0:~ }|
  3078. {0:~ }|
  3079. {0:~ }|
  3080. {0:~ }|
  3081. {0:~ }|
  3082. ## grid 3
  3083. :sign un^ |
  3084. ## grid 4
  3085. {7: }|
  3086. {12:~ }|
  3087. {12:~ }|
  3088. {12:~ }|
  3089. ## grid 5
  3090. {1: undefine }|
  3091. {1: unplace }|
  3092. ]], float_pos={
  3093. [5] = {{id = -1}, "SW", 1, 6, 5, false, 250};
  3094. [4] = {{id = 1001}, "NW", 1, 2, 5, true, 50};
  3095. }}
  3096. else
  3097. screen:expect{grid=[[
  3098. |
  3099. {0:~ }|
  3100. {0:~ }{7: }{0: }|
  3101. {0:~ }{12:~ }{0: }|
  3102. {0:~ }{1: undefine }{0: }|
  3103. {0:~ }{1: unplace }{0: }|
  3104. :sign un^ |
  3105. ]]}
  3106. end
  3107. end)
  3108. it('with ext_popupmenu', function()
  3109. screen:set_option('ext_popupmenu', true)
  3110. feed('ix ')
  3111. funcs.complete(3, {'aa', 'word', 'longtext'})
  3112. local items = {{"aa", "", "", ""}, {"word", "", "", ""}, {"longtext", "", "", ""}}
  3113. if multigrid then
  3114. screen:expect{grid=[[
  3115. ## grid 1
  3116. [2:----------------------------------------]|
  3117. [2:----------------------------------------]|
  3118. [2:----------------------------------------]|
  3119. [2:----------------------------------------]|
  3120. [2:----------------------------------------]|
  3121. [2:----------------------------------------]|
  3122. [3:----------------------------------------]|
  3123. ## grid 2
  3124. |
  3125. {0:~ }|
  3126. {0:~ }|
  3127. {0:~ }|
  3128. {0:~ }|
  3129. {0:~ }|
  3130. ## grid 3
  3131. {3:-- INSERT --} |
  3132. ## grid 4
  3133. {7:x aa^ }|
  3134. {12:~ }|
  3135. {12:~ }|
  3136. {12:~ }|
  3137. ]], float_pos={
  3138. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  3139. }, popupmenu={
  3140. anchor = {4, 0, 2}, items = items, pos = 0
  3141. }}
  3142. else
  3143. screen:expect{grid=[[
  3144. |
  3145. {0:~ }|
  3146. {0:~ }{7:x aa^ }{0: }|
  3147. {0:~ }{12:~ }{0: }|
  3148. {0:~ }{12:~ }{0: }|
  3149. {0:~ }{12:~ }{0: }|
  3150. {3:-- INSERT --} |
  3151. ]], popupmenu={
  3152. anchor = {1, 2, 7}, items = items, pos = 0
  3153. }}
  3154. end
  3155. feed('<esc>')
  3156. if multigrid then
  3157. screen:expect{grid=[[
  3158. ## grid 1
  3159. [2:----------------------------------------]|
  3160. [2:----------------------------------------]|
  3161. [2:----------------------------------------]|
  3162. [2:----------------------------------------]|
  3163. [2:----------------------------------------]|
  3164. [2:----------------------------------------]|
  3165. [3:----------------------------------------]|
  3166. ## grid 2
  3167. |
  3168. {0:~ }|
  3169. {0:~ }|
  3170. {0:~ }|
  3171. {0:~ }|
  3172. {0:~ }|
  3173. ## grid 3
  3174. |
  3175. ## grid 4
  3176. {7:x a^a }|
  3177. {12:~ }|
  3178. {12:~ }|
  3179. {12:~ }|
  3180. ]], float_pos={
  3181. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  3182. }}
  3183. else
  3184. screen:expect([[
  3185. |
  3186. {0:~ }|
  3187. {0:~ }{7:x a^a }{0: }|
  3188. {0:~ }{12:~ }{0: }|
  3189. {0:~ }{12:~ }{0: }|
  3190. {0:~ }{12:~ }{0: }|
  3191. |
  3192. ]])
  3193. end
  3194. feed('<c-w>wi')
  3195. funcs.complete(1, {'xx', 'yy', 'zz'})
  3196. items = {{"xx", "", "", ""}, {"yy", "", "", ""}, {"zz", "", "", ""}}
  3197. if multigrid then
  3198. screen:expect{grid=[[
  3199. ## grid 1
  3200. [2:----------------------------------------]|
  3201. [2:----------------------------------------]|
  3202. [2:----------------------------------------]|
  3203. [2:----------------------------------------]|
  3204. [2:----------------------------------------]|
  3205. [2:----------------------------------------]|
  3206. [3:----------------------------------------]|
  3207. ## grid 2
  3208. xx^ |
  3209. {0:~ }|
  3210. {0:~ }|
  3211. {0:~ }|
  3212. {0:~ }|
  3213. {0:~ }|
  3214. ## grid 3
  3215. {3:-- INSERT --} |
  3216. ## grid 4
  3217. {7:x aa }|
  3218. {12:~ }|
  3219. {12:~ }|
  3220. {12:~ }|
  3221. ]], float_pos={
  3222. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  3223. }, popupmenu={
  3224. anchor = {2, 0, 0}, items = items, pos = 0
  3225. }}
  3226. else
  3227. screen:expect{grid=[[
  3228. xx^ |
  3229. {0:~ }|
  3230. {0:~ }{7:x aa }{0: }|
  3231. {0:~ }{12:~ }{0: }|
  3232. {0:~ }{12:~ }{0: }|
  3233. {0:~ }{12:~ }{0: }|
  3234. {3:-- INSERT --} |
  3235. ]], popupmenu={
  3236. anchor = {1, 0, 0}, items = items, pos = 0
  3237. }}
  3238. end
  3239. feed('<c-y>')
  3240. if multigrid then
  3241. screen:expect{grid=[[
  3242. ## grid 1
  3243. [2:----------------------------------------]|
  3244. [2:----------------------------------------]|
  3245. [2:----------------------------------------]|
  3246. [2:----------------------------------------]|
  3247. [2:----------------------------------------]|
  3248. [2:----------------------------------------]|
  3249. [3:----------------------------------------]|
  3250. ## grid 2
  3251. xx^ |
  3252. {0:~ }|
  3253. {0:~ }|
  3254. {0:~ }|
  3255. {0:~ }|
  3256. {0:~ }|
  3257. ## grid 3
  3258. {3:-- INSERT --} |
  3259. ## grid 4
  3260. {7:x aa }|
  3261. {12:~ }|
  3262. {12:~ }|
  3263. {12:~ }|
  3264. ]], float_pos={
  3265. [4] = {{ id = 1001 }, "NW", 1, 2, 5, true},
  3266. }}
  3267. else
  3268. screen:expect([[
  3269. xx^ |
  3270. {0:~ }|
  3271. {0:~ }{7:x aa }{0: }|
  3272. {0:~ }{12:~ }{0: }|
  3273. {0:~ }{12:~ }{0: }|
  3274. {0:~ }{12:~ }{0: }|
  3275. {3:-- INSERT --} |
  3276. ]])
  3277. end
  3278. end)
  3279. end)
  3280. describe('float shown after pum', function()
  3281. local win
  3282. before_each(function()
  3283. command('hi NormalFloat guibg=#333333')
  3284. feed('i')
  3285. funcs.complete(1, {'aa', 'word', 'longtext'})
  3286. if multigrid then
  3287. screen:expect{grid=[[
  3288. ## grid 1
  3289. [2:----------------------------------------]|
  3290. [2:----------------------------------------]|
  3291. [2:----------------------------------------]|
  3292. [2:----------------------------------------]|
  3293. [2:----------------------------------------]|
  3294. [2:----------------------------------------]|
  3295. [3:----------------------------------------]|
  3296. ## grid 2
  3297. aa^ |
  3298. {0:~ }|
  3299. {0:~ }|
  3300. {0:~ }|
  3301. {0:~ }|
  3302. {0:~ }|
  3303. ## grid 3
  3304. {3:-- INSERT --} |
  3305. ## grid 4
  3306. {13:aa }|
  3307. {1:word }|
  3308. {1:longtext }|
  3309. ]], float_pos={
  3310. [4] = {{id = -1}, "NW", 2, 1, 0, false, 100}}
  3311. }
  3312. else
  3313. screen:expect([[
  3314. aa^ |
  3315. {13:aa }{0: }|
  3316. {1:word }{0: }|
  3317. {1:longtext }{0: }|
  3318. {0:~ }|
  3319. {0:~ }|
  3320. {3:-- INSERT --} |
  3321. ]])
  3322. end
  3323. local buf = meths.create_buf(false,true)
  3324. meths.buf_set_lines(buf,0,-1,true,{"some info", "about item"})
  3325. win = meths.open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10})
  3326. if multigrid then
  3327. screen:expect{grid=[[
  3328. ## grid 1
  3329. [2:----------------------------------------]|
  3330. [2:----------------------------------------]|
  3331. [2:----------------------------------------]|
  3332. [2:----------------------------------------]|
  3333. [2:----------------------------------------]|
  3334. [2:----------------------------------------]|
  3335. [3:----------------------------------------]|
  3336. ## grid 2
  3337. aa^ |
  3338. {0:~ }|
  3339. {0:~ }|
  3340. {0:~ }|
  3341. {0:~ }|
  3342. {0:~ }|
  3343. ## grid 3
  3344. {3:-- INSERT --} |
  3345. ## grid 4
  3346. {13:aa }|
  3347. {1:word }|
  3348. {1:longtext }|
  3349. ## grid 6
  3350. {15:some info }|
  3351. {15:about item }|
  3352. ]], float_pos={
  3353. [4] = {{id = -1}, "NW", 2, 1, 0, false, 100},
  3354. [6] = {{id = 1002}, "NW", 2, 1, 12, true, 50},
  3355. }}
  3356. else
  3357. screen:expect([[
  3358. aa^ |
  3359. {13:aa }{15:e info }{0: }|
  3360. {1:word }{15:ut item }{0: }|
  3361. {1:longtext }{0: }|
  3362. {0:~ }|
  3363. {0:~ }|
  3364. {3:-- INSERT --} |
  3365. ]])
  3366. end
  3367. end)
  3368. it('and close pum first', function()
  3369. feed('<c-y>')
  3370. if multigrid then
  3371. screen:expect{grid=[[
  3372. ## grid 1
  3373. [2:----------------------------------------]|
  3374. [2:----------------------------------------]|
  3375. [2:----------------------------------------]|
  3376. [2:----------------------------------------]|
  3377. [2:----------------------------------------]|
  3378. [2:----------------------------------------]|
  3379. [3:----------------------------------------]|
  3380. ## grid 2
  3381. aa^ |
  3382. {0:~ }|
  3383. {0:~ }|
  3384. {0:~ }|
  3385. {0:~ }|
  3386. {0:~ }|
  3387. ## grid 3
  3388. {3:-- INSERT --} |
  3389. ## grid 6
  3390. {15:some info }|
  3391. {15:about item }|
  3392. ]], float_pos={
  3393. [6] = {{id = 1002}, "NW", 2, 1, 12, true},
  3394. }}
  3395. else
  3396. screen:expect([[
  3397. aa^ |
  3398. {0:~ }{15:some info }{0: }|
  3399. {0:~ }{15:about item }{0: }|
  3400. {0:~ }|
  3401. {0:~ }|
  3402. {0:~ }|
  3403. {3:-- INSERT --} |
  3404. ]])
  3405. end
  3406. meths.win_close(win, false)
  3407. if multigrid then
  3408. screen:expect([[
  3409. ## grid 1
  3410. [2:----------------------------------------]|
  3411. [2:----------------------------------------]|
  3412. [2:----------------------------------------]|
  3413. [2:----------------------------------------]|
  3414. [2:----------------------------------------]|
  3415. [2:----------------------------------------]|
  3416. [3:----------------------------------------]|
  3417. ## grid 2
  3418. aa^ |
  3419. {0:~ }|
  3420. {0:~ }|
  3421. {0:~ }|
  3422. {0:~ }|
  3423. {0:~ }|
  3424. ## grid 3
  3425. {3:-- INSERT --} |
  3426. ]])
  3427. else
  3428. screen:expect([[
  3429. aa^ |
  3430. {0:~ }|
  3431. {0:~ }|
  3432. {0:~ }|
  3433. {0:~ }|
  3434. {0:~ }|
  3435. {3:-- INSERT --} |
  3436. ]])
  3437. end
  3438. end)
  3439. it('and close float first', function()
  3440. meths.win_close(win, false)
  3441. if multigrid then
  3442. screen:expect{grid=[[
  3443. ## grid 1
  3444. [2:----------------------------------------]|
  3445. [2:----------------------------------------]|
  3446. [2:----------------------------------------]|
  3447. [2:----------------------------------------]|
  3448. [2:----------------------------------------]|
  3449. [2:----------------------------------------]|
  3450. [3:----------------------------------------]|
  3451. ## grid 2
  3452. aa^ |
  3453. {0:~ }|
  3454. {0:~ }|
  3455. {0:~ }|
  3456. {0:~ }|
  3457. {0:~ }|
  3458. ## grid 3
  3459. {3:-- INSERT --} |
  3460. ## grid 4
  3461. {13:aa }|
  3462. {1:word }|
  3463. {1:longtext }|
  3464. ]], float_pos={
  3465. [4] = {{id = -1}, "NW", 2, 1, 0, false, 100},
  3466. }}
  3467. else
  3468. screen:expect([[
  3469. aa^ |
  3470. {13:aa }{0: }|
  3471. {1:word }{0: }|
  3472. {1:longtext }{0: }|
  3473. {0:~ }|
  3474. {0:~ }|
  3475. {3:-- INSERT --} |
  3476. ]])
  3477. end
  3478. feed('<c-y>')
  3479. if multigrid then
  3480. screen:expect([[
  3481. ## grid 1
  3482. [2:----------------------------------------]|
  3483. [2:----------------------------------------]|
  3484. [2:----------------------------------------]|
  3485. [2:----------------------------------------]|
  3486. [2:----------------------------------------]|
  3487. [2:----------------------------------------]|
  3488. [3:----------------------------------------]|
  3489. ## grid 2
  3490. aa^ |
  3491. {0:~ }|
  3492. {0:~ }|
  3493. {0:~ }|
  3494. {0:~ }|
  3495. {0:~ }|
  3496. ## grid 3
  3497. {3:-- INSERT --} |
  3498. ]])
  3499. else
  3500. screen:expect([[
  3501. aa^ |
  3502. {0:~ }|
  3503. {0:~ }|
  3504. {0:~ }|
  3505. {0:~ }|
  3506. {0:~ }|
  3507. {3:-- INSERT --} |
  3508. ]])
  3509. end
  3510. end)
  3511. end)
  3512. describe("handles :wincmd", function()
  3513. local win
  3514. local expected_pos
  3515. before_each(function()
  3516. -- the default, but be explicit:
  3517. command("set laststatus=1")
  3518. command("set hidden")
  3519. meths.buf_set_lines(0,0,-1,true,{"x"})
  3520. local buf = meths.create_buf(false,false)
  3521. win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  3522. meths.buf_set_lines(buf,0,-1,true,{"y"})
  3523. expected_pos = {
  3524. [4]={{id=1001}, 'NW', 1, 2, 5, true}
  3525. }
  3526. if multigrid then
  3527. screen:expect{grid=[[
  3528. ## grid 1
  3529. [2:----------------------------------------]|
  3530. [2:----------------------------------------]|
  3531. [2:----------------------------------------]|
  3532. [2:----------------------------------------]|
  3533. [2:----------------------------------------]|
  3534. [2:----------------------------------------]|
  3535. [3:----------------------------------------]|
  3536. ## grid 2
  3537. ^x |
  3538. {0:~ }|
  3539. {0:~ }|
  3540. {0:~ }|
  3541. {0:~ }|
  3542. {0:~ }|
  3543. ## grid 3
  3544. |
  3545. ## grid 4
  3546. {1:y }|
  3547. {2:~ }|
  3548. ]], float_pos=expected_pos}
  3549. else
  3550. screen:expect([[
  3551. ^x |
  3552. {0:~ }|
  3553. {0:~ }{1:y }{0: }|
  3554. {0:~ }{2:~ }{0: }|
  3555. {0:~ }|
  3556. {0:~ }|
  3557. |
  3558. ]])
  3559. end
  3560. end)
  3561. it("w", function()
  3562. feed("<c-w>w")
  3563. if multigrid then
  3564. screen:expect{grid=[[
  3565. ## grid 1
  3566. [2:----------------------------------------]|
  3567. [2:----------------------------------------]|
  3568. [2:----------------------------------------]|
  3569. [2:----------------------------------------]|
  3570. [2:----------------------------------------]|
  3571. [2:----------------------------------------]|
  3572. [3:----------------------------------------]|
  3573. ## grid 2
  3574. x |
  3575. {0:~ }|
  3576. {0:~ }|
  3577. {0:~ }|
  3578. {0:~ }|
  3579. {0:~ }|
  3580. ## grid 3
  3581. |
  3582. ## grid 4
  3583. {1:^y }|
  3584. {2:~ }|
  3585. ]], float_pos=expected_pos}
  3586. else
  3587. screen:expect([[
  3588. x |
  3589. {0:~ }|
  3590. {0:~ }{1:^y }{0: }|
  3591. {0:~ }{2:~ }{0: }|
  3592. {0:~ }|
  3593. {0:~ }|
  3594. |
  3595. ]])
  3596. end
  3597. feed("<c-w>w")
  3598. if multigrid then
  3599. screen:expect{grid=[[
  3600. ## grid 1
  3601. [2:----------------------------------------]|
  3602. [2:----------------------------------------]|
  3603. [2:----------------------------------------]|
  3604. [2:----------------------------------------]|
  3605. [2:----------------------------------------]|
  3606. [2:----------------------------------------]|
  3607. [3:----------------------------------------]|
  3608. ## grid 2
  3609. ^x |
  3610. {0:~ }|
  3611. {0:~ }|
  3612. {0:~ }|
  3613. {0:~ }|
  3614. {0:~ }|
  3615. ## grid 3
  3616. |
  3617. ## grid 4
  3618. {1:y }|
  3619. {2:~ }|
  3620. ]], float_pos=expected_pos}
  3621. else
  3622. screen:expect([[
  3623. ^x |
  3624. {0:~ }|
  3625. {0:~ }{1:y }{0: }|
  3626. {0:~ }{2:~ }{0: }|
  3627. {0:~ }|
  3628. {0:~ }|
  3629. |
  3630. ]])
  3631. end
  3632. end)
  3633. it("w with focusable=false", function()
  3634. meths.win_set_config(win, {focusable=false})
  3635. expected_pos[4][6] = false
  3636. feed("<c-w>wi") -- i to provoke redraw
  3637. if multigrid then
  3638. screen:expect{grid=[[
  3639. ## grid 1
  3640. [2:----------------------------------------]|
  3641. [2:----------------------------------------]|
  3642. [2:----------------------------------------]|
  3643. [2:----------------------------------------]|
  3644. [2:----------------------------------------]|
  3645. [2:----------------------------------------]|
  3646. [3:----------------------------------------]|
  3647. ## grid 2
  3648. ^x |
  3649. {0:~ }|
  3650. {0:~ }|
  3651. {0:~ }|
  3652. {0:~ }|
  3653. {0:~ }|
  3654. ## grid 3
  3655. {3:-- INSERT --} |
  3656. ## grid 4
  3657. {1:y }|
  3658. {2:~ }|
  3659. ]], float_pos=expected_pos}
  3660. else
  3661. screen:expect([[
  3662. ^x |
  3663. {0:~ }|
  3664. {0:~ }{1:y }{0: }|
  3665. {0:~ }{2:~ }{0: }|
  3666. {0:~ }|
  3667. {0:~ }|
  3668. {3:-- INSERT --} |
  3669. ]])
  3670. end
  3671. feed("<esc><c-w>w")
  3672. if multigrid then
  3673. screen:expect{grid=[[
  3674. ## grid 1
  3675. [2:----------------------------------------]|
  3676. [2:----------------------------------------]|
  3677. [2:----------------------------------------]|
  3678. [2:----------------------------------------]|
  3679. [2:----------------------------------------]|
  3680. [2:----------------------------------------]|
  3681. [3:----------------------------------------]|
  3682. ## grid 2
  3683. ^x |
  3684. {0:~ }|
  3685. {0:~ }|
  3686. {0:~ }|
  3687. {0:~ }|
  3688. {0:~ }|
  3689. ## grid 3
  3690. |
  3691. ## grid 4
  3692. {1:y }|
  3693. {2:~ }|
  3694. ]], float_pos=expected_pos}
  3695. else
  3696. screen:expect([[
  3697. ^x |
  3698. {0:~ }|
  3699. {0:~ }{1:y }{0: }|
  3700. {0:~ }{2:~ }{0: }|
  3701. {0:~ }|
  3702. {0:~ }|
  3703. |
  3704. ]])
  3705. end
  3706. end)
  3707. it("W", function()
  3708. feed("<c-w>W")
  3709. if multigrid then
  3710. screen:expect{grid=[[
  3711. ## grid 1
  3712. [2:----------------------------------------]|
  3713. [2:----------------------------------------]|
  3714. [2:----------------------------------------]|
  3715. [2:----------------------------------------]|
  3716. [2:----------------------------------------]|
  3717. [2:----------------------------------------]|
  3718. [3:----------------------------------------]|
  3719. ## grid 2
  3720. x |
  3721. {0:~ }|
  3722. {0:~ }|
  3723. {0:~ }|
  3724. {0:~ }|
  3725. {0:~ }|
  3726. ## grid 3
  3727. |
  3728. ## grid 4
  3729. {1:^y }|
  3730. {2:~ }|
  3731. ]], float_pos=expected_pos}
  3732. else
  3733. screen:expect([[
  3734. x |
  3735. {0:~ }|
  3736. {0:~ }{1:^y }{0: }|
  3737. {0:~ }{2:~ }{0: }|
  3738. {0:~ }|
  3739. {0:~ }|
  3740. |
  3741. ]])
  3742. end
  3743. feed("<c-w>W")
  3744. if multigrid then
  3745. screen:expect{grid=[[
  3746. ## grid 1
  3747. [2:----------------------------------------]|
  3748. [2:----------------------------------------]|
  3749. [2:----------------------------------------]|
  3750. [2:----------------------------------------]|
  3751. [2:----------------------------------------]|
  3752. [2:----------------------------------------]|
  3753. [3:----------------------------------------]|
  3754. ## grid 2
  3755. ^x |
  3756. {0:~ }|
  3757. {0:~ }|
  3758. {0:~ }|
  3759. {0:~ }|
  3760. {0:~ }|
  3761. ## grid 3
  3762. |
  3763. ## grid 4
  3764. {1:y }|
  3765. {2:~ }|
  3766. ]], float_pos=expected_pos}
  3767. else
  3768. screen:expect([[
  3769. ^x |
  3770. {0:~ }|
  3771. {0:~ }{1:y }{0: }|
  3772. {0:~ }{2:~ }{0: }|
  3773. {0:~ }|
  3774. {0:~ }|
  3775. |
  3776. ]])
  3777. end
  3778. end)
  3779. it("focus by mouse", function()
  3780. if multigrid then
  3781. meths.input_mouse('left', 'press', '', 4, 0, 0)
  3782. screen:expect{grid=[[
  3783. ## grid 1
  3784. [2:----------------------------------------]|
  3785. [2:----------------------------------------]|
  3786. [2:----------------------------------------]|
  3787. [2:----------------------------------------]|
  3788. [2:----------------------------------------]|
  3789. [2:----------------------------------------]|
  3790. [3:----------------------------------------]|
  3791. ## grid 2
  3792. x |
  3793. {0:~ }|
  3794. {0:~ }|
  3795. {0:~ }|
  3796. {0:~ }|
  3797. {0:~ }|
  3798. ## grid 3
  3799. |
  3800. ## grid 4
  3801. {1:^y }|
  3802. {2:~ }|
  3803. ]], float_pos=expected_pos}
  3804. else
  3805. meths.input_mouse('left', 'press', '', 0, 2, 5)
  3806. screen:expect([[
  3807. x |
  3808. {0:~ }|
  3809. {0:~ }{1:^y }{0: }|
  3810. {0:~ }{2:~ }{0: }|
  3811. {0:~ }|
  3812. {0:~ }|
  3813. |
  3814. ]])
  3815. end
  3816. if multigrid then
  3817. meths.input_mouse('left', 'press', '', 1, 0, 0)
  3818. screen:expect{grid=[[
  3819. ## grid 1
  3820. [2:----------------------------------------]|
  3821. [2:----------------------------------------]|
  3822. [2:----------------------------------------]|
  3823. [2:----------------------------------------]|
  3824. [2:----------------------------------------]|
  3825. [2:----------------------------------------]|
  3826. [3:----------------------------------------]|
  3827. ## grid 2
  3828. ^x |
  3829. {0:~ }|
  3830. {0:~ }|
  3831. {0:~ }|
  3832. {0:~ }|
  3833. {0:~ }|
  3834. ## grid 3
  3835. |
  3836. ## grid 4
  3837. {1:y }|
  3838. {2:~ }|
  3839. ]], float_pos=expected_pos}
  3840. else
  3841. meths.input_mouse('left', 'press', '', 0, 0, 0)
  3842. screen:expect([[
  3843. ^x |
  3844. {0:~ }|
  3845. {0:~ }{1:y }{0: }|
  3846. {0:~ }{2:~ }{0: }|
  3847. {0:~ }|
  3848. {0:~ }|
  3849. |
  3850. ]])
  3851. end
  3852. end)
  3853. it("focus by mouse (focusable=false)", function()
  3854. meths.win_set_config(win, {focusable=false})
  3855. meths.buf_set_lines(0, -1, -1, true, {"a"})
  3856. expected_pos[4][6] = false
  3857. if multigrid then
  3858. meths.input_mouse('left', 'press', '', 4, 0, 0)
  3859. screen:expect{grid=[[
  3860. ## grid 1
  3861. [2:----------------------------------------]|
  3862. [2:----------------------------------------]|
  3863. [2:----------------------------------------]|
  3864. [2:----------------------------------------]|
  3865. [2:----------------------------------------]|
  3866. [2:----------------------------------------]|
  3867. [3:----------------------------------------]|
  3868. ## grid 2
  3869. ^x |
  3870. a |
  3871. {0:~ }|
  3872. {0:~ }|
  3873. {0:~ }|
  3874. {0:~ }|
  3875. ## grid 3
  3876. |
  3877. ## grid 4
  3878. {1:y }|
  3879. {2:~ }|
  3880. ]], float_pos=expected_pos}
  3881. else
  3882. meths.input_mouse('left', 'press', '', 0, 2, 5)
  3883. screen:expect([[
  3884. x |
  3885. ^a |
  3886. {0:~ }{1:y }{0: }|
  3887. {0:~ }{2:~ }{0: }|
  3888. {0:~ }|
  3889. {0:~ }|
  3890. |
  3891. ]])
  3892. end
  3893. if multigrid then
  3894. meths.input_mouse('left', 'press', '', 1, 0, 0)
  3895. screen:expect{grid=[[
  3896. ## grid 1
  3897. [2:----------------------------------------]|
  3898. [2:----------------------------------------]|
  3899. [2:----------------------------------------]|
  3900. [2:----------------------------------------]|
  3901. [2:----------------------------------------]|
  3902. [2:----------------------------------------]|
  3903. [3:----------------------------------------]|
  3904. ## grid 2
  3905. ^x |
  3906. a |
  3907. {0:~ }|
  3908. {0:~ }|
  3909. {0:~ }|
  3910. {0:~ }|
  3911. ## grid 3
  3912. |
  3913. ## grid 4
  3914. {1:y }|
  3915. {2:~ }|
  3916. ]], float_pos=expected_pos, unchanged=true}
  3917. else
  3918. meths.input_mouse('left', 'press', '', 0, 0, 0)
  3919. screen:expect([[
  3920. ^x |
  3921. a |
  3922. {0:~ }{1:y }{0: }|
  3923. {0:~ }{2:~ }{0: }|
  3924. {0:~ }|
  3925. {0:~ }|
  3926. |
  3927. ]])
  3928. end
  3929. end)
  3930. it("j", function()
  3931. feed("<c-w>ji") -- INSERT to trigger screen change
  3932. if multigrid then
  3933. screen:expect{grid=[[
  3934. ## grid 1
  3935. [2:----------------------------------------]|
  3936. [2:----------------------------------------]|
  3937. [2:----------------------------------------]|
  3938. [2:----------------------------------------]|
  3939. [2:----------------------------------------]|
  3940. [2:----------------------------------------]|
  3941. [3:----------------------------------------]|
  3942. ## grid 2
  3943. ^x |
  3944. {0:~ }|
  3945. {0:~ }|
  3946. {0:~ }|
  3947. {0:~ }|
  3948. {0:~ }|
  3949. ## grid 3
  3950. {3:-- INSERT --} |
  3951. ## grid 4
  3952. {1:y }|
  3953. {2:~ }|
  3954. ]], float_pos=expected_pos}
  3955. else
  3956. screen:expect([[
  3957. ^x |
  3958. {0:~ }|
  3959. {0:~ }{1:y }{0: }|
  3960. {0:~ }{2:~ }{0: }|
  3961. {0:~ }|
  3962. {0:~ }|
  3963. {3:-- INSERT --} |
  3964. ]])
  3965. end
  3966. feed("<esc><c-w>w")
  3967. if multigrid then
  3968. screen:expect{grid=[[
  3969. ## grid 1
  3970. [2:----------------------------------------]|
  3971. [2:----------------------------------------]|
  3972. [2:----------------------------------------]|
  3973. [2:----------------------------------------]|
  3974. [2:----------------------------------------]|
  3975. [2:----------------------------------------]|
  3976. [3:----------------------------------------]|
  3977. ## grid 2
  3978. x |
  3979. {0:~ }|
  3980. {0:~ }|
  3981. {0:~ }|
  3982. {0:~ }|
  3983. {0:~ }|
  3984. ## grid 3
  3985. |
  3986. ## grid 4
  3987. {1:^y }|
  3988. {2:~ }|
  3989. ]], float_pos=expected_pos}
  3990. else
  3991. screen:expect([[
  3992. x |
  3993. {0:~ }|
  3994. {0:~ }{1:^y }{0: }|
  3995. {0:~ }{2:~ }{0: }|
  3996. {0:~ }|
  3997. {0:~ }|
  3998. |
  3999. ]])
  4000. end
  4001. feed("<c-w>j")
  4002. if multigrid then
  4003. screen:expect{grid=[[
  4004. ## grid 1
  4005. [2:----------------------------------------]|
  4006. [2:----------------------------------------]|
  4007. [2:----------------------------------------]|
  4008. [2:----------------------------------------]|
  4009. [2:----------------------------------------]|
  4010. [2:----------------------------------------]|
  4011. [3:----------------------------------------]|
  4012. ## grid 2
  4013. ^x |
  4014. {0:~ }|
  4015. {0:~ }|
  4016. {0:~ }|
  4017. {0:~ }|
  4018. {0:~ }|
  4019. ## grid 3
  4020. |
  4021. ## grid 4
  4022. {1:y }|
  4023. {2:~ }|
  4024. ]], float_pos=expected_pos}
  4025. else
  4026. screen:expect([[
  4027. ^x |
  4028. {0:~ }|
  4029. {0:~ }{1:y }{0: }|
  4030. {0:~ }{2:~ }{0: }|
  4031. {0:~ }|
  4032. {0:~ }|
  4033. |
  4034. ]])
  4035. end
  4036. end)
  4037. it("vertical resize + - _", function()
  4038. feed('<c-w>w')
  4039. if multigrid then
  4040. screen:expect{grid=[[
  4041. ## grid 1
  4042. [2:----------------------------------------]|
  4043. [2:----------------------------------------]|
  4044. [2:----------------------------------------]|
  4045. [2:----------------------------------------]|
  4046. [2:----------------------------------------]|
  4047. [2:----------------------------------------]|
  4048. [3:----------------------------------------]|
  4049. ## grid 2
  4050. x |
  4051. {0:~ }|
  4052. {0:~ }|
  4053. {0:~ }|
  4054. {0:~ }|
  4055. {0:~ }|
  4056. ## grid 3
  4057. |
  4058. ## grid 4
  4059. {1:^y }|
  4060. {2:~ }|
  4061. ]], float_pos=expected_pos}
  4062. else
  4063. screen:expect([[
  4064. x |
  4065. {0:~ }|
  4066. {0:~ }{1:^y }{0: }|
  4067. {0:~ }{2:~ }{0: }|
  4068. {0:~ }|
  4069. {0:~ }|
  4070. |
  4071. ]])
  4072. end
  4073. feed('<c-w>+')
  4074. if multigrid then
  4075. screen:expect{grid=[[
  4076. ## grid 1
  4077. [2:----------------------------------------]|
  4078. [2:----------------------------------------]|
  4079. [2:----------------------------------------]|
  4080. [2:----------------------------------------]|
  4081. [2:----------------------------------------]|
  4082. [2:----------------------------------------]|
  4083. [3:----------------------------------------]|
  4084. ## grid 2
  4085. x |
  4086. {0:~ }|
  4087. {0:~ }|
  4088. {0:~ }|
  4089. {0:~ }|
  4090. {0:~ }|
  4091. ## grid 3
  4092. |
  4093. ## grid 4
  4094. {1:^y }|
  4095. {2:~ }|
  4096. {2:~ }|
  4097. ]], float_pos=expected_pos}
  4098. else
  4099. screen:expect([[
  4100. x |
  4101. {0:~ }|
  4102. {0:~ }{1:^y }{0: }|
  4103. {0:~ }{2:~ }{0: }|
  4104. {0:~ }{2:~ }{0: }|
  4105. {0:~ }|
  4106. |
  4107. ]])
  4108. end
  4109. feed('<c-w>2-')
  4110. if multigrid then
  4111. screen:expect{grid=[[
  4112. ## grid 1
  4113. [2:----------------------------------------]|
  4114. [2:----------------------------------------]|
  4115. [2:----------------------------------------]|
  4116. [2:----------------------------------------]|
  4117. [2:----------------------------------------]|
  4118. [2:----------------------------------------]|
  4119. [3:----------------------------------------]|
  4120. ## grid 2
  4121. x |
  4122. {0:~ }|
  4123. {0:~ }|
  4124. {0:~ }|
  4125. {0:~ }|
  4126. {0:~ }|
  4127. ## grid 3
  4128. |
  4129. ## grid 4
  4130. {1:^y }|
  4131. ]], float_pos=expected_pos}
  4132. else
  4133. screen:expect([[
  4134. x |
  4135. {0:~ }|
  4136. {0:~ }{1:^y }{0: }|
  4137. {0:~ }|
  4138. {0:~ }|
  4139. {0:~ }|
  4140. |
  4141. ]])
  4142. end
  4143. feed('<c-w>4_')
  4144. if multigrid then
  4145. screen:expect{grid=[[
  4146. ## grid 1
  4147. [2:----------------------------------------]|
  4148. [2:----------------------------------------]|
  4149. [2:----------------------------------------]|
  4150. [2:----------------------------------------]|
  4151. [2:----------------------------------------]|
  4152. [2:----------------------------------------]|
  4153. [3:----------------------------------------]|
  4154. ## grid 2
  4155. x |
  4156. {0:~ }|
  4157. {0:~ }|
  4158. {0:~ }|
  4159. {0:~ }|
  4160. {0:~ }|
  4161. ## grid 3
  4162. |
  4163. ## grid 4
  4164. {1:^y }|
  4165. {2:~ }|
  4166. {2:~ }|
  4167. {2:~ }|
  4168. ]], float_pos=expected_pos}
  4169. else
  4170. screen:expect([[
  4171. x |
  4172. {0:~ }|
  4173. {0:~ }{1:^y }{0: }|
  4174. {0:~ }{2:~ }{0: }|
  4175. {0:~ }{2:~ }{0: }|
  4176. {0:~ }{2:~ }{0: }|
  4177. |
  4178. ]])
  4179. end
  4180. feed('<c-w>_')
  4181. if multigrid then
  4182. screen:expect{grid=[[
  4183. ## grid 1
  4184. [2:----------------------------------------]|
  4185. [2:----------------------------------------]|
  4186. [2:----------------------------------------]|
  4187. [2:----------------------------------------]|
  4188. [2:----------------------------------------]|
  4189. [2:----------------------------------------]|
  4190. [3:----------------------------------------]|
  4191. ## grid 2
  4192. x |
  4193. {0:~ }|
  4194. {0:~ }|
  4195. {0:~ }|
  4196. {0:~ }|
  4197. {0:~ }|
  4198. ## grid 3
  4199. |
  4200. ## grid 4
  4201. {1:^y }|
  4202. {2:~ }|
  4203. {2:~ }|
  4204. {2:~ }|
  4205. {2:~ }|
  4206. {2:~ }|
  4207. ]], float_pos=expected_pos}
  4208. else
  4209. screen:expect([[
  4210. x {1:^y } |
  4211. {0:~ }{2:~ }{0: }|
  4212. {0:~ }{2:~ }{0: }|
  4213. {0:~ }{2:~ }{0: }|
  4214. {0:~ }{2:~ }{0: }|
  4215. {0:~ }{2:~ }{0: }|
  4216. |
  4217. ]])
  4218. end
  4219. end)
  4220. it("horizontal resize > < |", function()
  4221. feed('<c-w>w')
  4222. if multigrid then
  4223. screen:expect{grid=[[
  4224. ## grid 1
  4225. [2:----------------------------------------]|
  4226. [2:----------------------------------------]|
  4227. [2:----------------------------------------]|
  4228. [2:----------------------------------------]|
  4229. [2:----------------------------------------]|
  4230. [2:----------------------------------------]|
  4231. [3:----------------------------------------]|
  4232. ## grid 2
  4233. x |
  4234. {0:~ }|
  4235. {0:~ }|
  4236. {0:~ }|
  4237. {0:~ }|
  4238. {0:~ }|
  4239. ## grid 3
  4240. |
  4241. ## grid 4
  4242. {1:^y }|
  4243. {2:~ }|
  4244. ]], float_pos=expected_pos}
  4245. else
  4246. screen:expect([[
  4247. x |
  4248. {0:~ }|
  4249. {0:~ }{1:^y }{0: }|
  4250. {0:~ }{2:~ }{0: }|
  4251. {0:~ }|
  4252. {0:~ }|
  4253. |
  4254. ]])
  4255. end
  4256. feed('<c-w>>')
  4257. if multigrid then
  4258. screen:expect{grid=[[
  4259. ## grid 1
  4260. [2:----------------------------------------]|
  4261. [2:----------------------------------------]|
  4262. [2:----------------------------------------]|
  4263. [2:----------------------------------------]|
  4264. [2:----------------------------------------]|
  4265. [2:----------------------------------------]|
  4266. [3:----------------------------------------]|
  4267. ## grid 2
  4268. x |
  4269. {0:~ }|
  4270. {0:~ }|
  4271. {0:~ }|
  4272. {0:~ }|
  4273. {0:~ }|
  4274. ## grid 3
  4275. |
  4276. ## grid 4
  4277. {1:^y }|
  4278. {2:~ }|
  4279. ]], float_pos=expected_pos}
  4280. else
  4281. screen:expect([[
  4282. x |
  4283. {0:~ }|
  4284. {0:~ }{1:^y }{0: }|
  4285. {0:~ }{2:~ }{0: }|
  4286. {0:~ }|
  4287. {0:~ }|
  4288. |
  4289. ]])
  4290. end
  4291. feed('<c-w>10<lt>')
  4292. if multigrid then
  4293. screen:expect{grid=[[
  4294. ## grid 1
  4295. [2:----------------------------------------]|
  4296. [2:----------------------------------------]|
  4297. [2:----------------------------------------]|
  4298. [2:----------------------------------------]|
  4299. [2:----------------------------------------]|
  4300. [2:----------------------------------------]|
  4301. [3:----------------------------------------]|
  4302. ## grid 2
  4303. x |
  4304. {0:~ }|
  4305. {0:~ }|
  4306. {0:~ }|
  4307. {0:~ }|
  4308. {0:~ }|
  4309. ## grid 3
  4310. |
  4311. ## grid 4
  4312. {1:^y }|
  4313. {2:~ }|
  4314. ]], float_pos=expected_pos}
  4315. else
  4316. screen:expect([[
  4317. x |
  4318. {0:~ }|
  4319. {0:~ }{1:^y }{0: }|
  4320. {0:~ }{2:~ }{0: }|
  4321. {0:~ }|
  4322. {0:~ }|
  4323. |
  4324. ]])
  4325. end
  4326. feed('<c-w>15|')
  4327. if multigrid then
  4328. screen:expect{grid=[[
  4329. ## grid 1
  4330. [2:----------------------------------------]|
  4331. [2:----------------------------------------]|
  4332. [2:----------------------------------------]|
  4333. [2:----------------------------------------]|
  4334. [2:----------------------------------------]|
  4335. [2:----------------------------------------]|
  4336. [3:----------------------------------------]|
  4337. ## grid 2
  4338. x |
  4339. {0:~ }|
  4340. {0:~ }|
  4341. {0:~ }|
  4342. {0:~ }|
  4343. {0:~ }|
  4344. ## grid 3
  4345. |
  4346. ## grid 4
  4347. {1:^y }|
  4348. {2:~ }|
  4349. ]], float_pos=expected_pos}
  4350. else
  4351. screen:expect([[
  4352. x |
  4353. {0:~ }|
  4354. {0:~ }{1:^y }{0: }|
  4355. {0:~ }{2:~ }{0: }|
  4356. {0:~ }|
  4357. {0:~ }|
  4358. |
  4359. ]])
  4360. end
  4361. feed('<c-w>|')
  4362. if multigrid then
  4363. screen:expect{grid=[[
  4364. ## grid 1
  4365. [2:----------------------------------------]|
  4366. [2:----------------------------------------]|
  4367. [2:----------------------------------------]|
  4368. [2:----------------------------------------]|
  4369. [2:----------------------------------------]|
  4370. [2:----------------------------------------]|
  4371. [3:----------------------------------------]|
  4372. ## grid 2
  4373. x |
  4374. {0:~ }|
  4375. {0:~ }|
  4376. {0:~ }|
  4377. {0:~ }|
  4378. {0:~ }|
  4379. ## grid 3
  4380. |
  4381. ## grid 4
  4382. {1:^y }|
  4383. {2:~ }|
  4384. ]], float_pos=expected_pos}
  4385. else
  4386. screen:expect([[
  4387. x |
  4388. {0:~ }|
  4389. {1:^y }|
  4390. {2:~ }|
  4391. {0:~ }|
  4392. {0:~ }|
  4393. |
  4394. ]])
  4395. end
  4396. end)
  4397. it("s :split (non-float)", function()
  4398. feed("<c-w>s")
  4399. if multigrid then
  4400. screen:expect{grid=[[
  4401. ## grid 1
  4402. [5:----------------------------------------]|
  4403. [5:----------------------------------------]|
  4404. {4:[No Name] [+] }|
  4405. [2:----------------------------------------]|
  4406. [2:----------------------------------------]|
  4407. {5:[No Name] [+] }|
  4408. [3:----------------------------------------]|
  4409. ## grid 2
  4410. x |
  4411. {0:~ }|
  4412. ## grid 3
  4413. |
  4414. ## grid 4
  4415. {1:y }|
  4416. {2:~ }|
  4417. ## grid 5
  4418. ^x |
  4419. {0:~ }|
  4420. ]], float_pos=expected_pos}
  4421. else
  4422. screen:expect([[
  4423. ^x |
  4424. {0:~ }|
  4425. {4:[No N}{1:y }{4: }|
  4426. x {2:~ } |
  4427. {0:~ }|
  4428. {5:[No Name] [+] }|
  4429. |
  4430. ]])
  4431. end
  4432. feed("<c-w>w")
  4433. if multigrid then
  4434. screen:expect{grid=[[
  4435. ## grid 1
  4436. [5:----------------------------------------]|
  4437. [5:----------------------------------------]|
  4438. {5:[No Name] [+] }|
  4439. [2:----------------------------------------]|
  4440. [2:----------------------------------------]|
  4441. {4:[No Name] [+] }|
  4442. [3:----------------------------------------]|
  4443. ## grid 2
  4444. ^x |
  4445. {0:~ }|
  4446. ## grid 3
  4447. |
  4448. ## grid 4
  4449. {1:y }|
  4450. {2:~ }|
  4451. ## grid 5
  4452. x |
  4453. {0:~ }|
  4454. ]], float_pos=expected_pos}
  4455. else
  4456. screen:expect([[
  4457. x |
  4458. {0:~ }|
  4459. {5:[No N}{1:y }{5: }|
  4460. ^x {2:~ } |
  4461. {0:~ }|
  4462. {4:[No Name] [+] }|
  4463. |
  4464. ]])
  4465. end
  4466. feed("<c-w>w")
  4467. if multigrid then
  4468. screen:expect{grid=[[
  4469. ## grid 1
  4470. [5:----------------------------------------]|
  4471. [5:----------------------------------------]|
  4472. {5:[No Name] [+] }|
  4473. [2:----------------------------------------]|
  4474. [2:----------------------------------------]|
  4475. {5:[No Name] [+] }|
  4476. [3:----------------------------------------]|
  4477. ## grid 2
  4478. x |
  4479. {0:~ }|
  4480. ## grid 3
  4481. |
  4482. ## grid 4
  4483. {1:^y }|
  4484. {2:~ }|
  4485. ## grid 5
  4486. x |
  4487. {0:~ }|
  4488. ]], float_pos=expected_pos}
  4489. else
  4490. screen:expect([[
  4491. x |
  4492. {0:~ }|
  4493. {5:[No N}{1:^y }{5: }|
  4494. x {2:~ } |
  4495. {0:~ }|
  4496. {5:[No Name] [+] }|
  4497. |
  4498. ]])
  4499. end
  4500. feed("<c-w>w")
  4501. if multigrid then
  4502. screen:expect{grid=[[
  4503. ## grid 1
  4504. [5:----------------------------------------]|
  4505. [5:----------------------------------------]|
  4506. {4:[No Name] [+] }|
  4507. [2:----------------------------------------]|
  4508. [2:----------------------------------------]|
  4509. {5:[No Name] [+] }|
  4510. [3:----------------------------------------]|
  4511. ## grid 2
  4512. x |
  4513. {0:~ }|
  4514. ## grid 3
  4515. |
  4516. ## grid 4
  4517. {1:y }|
  4518. {2:~ }|
  4519. ## grid 5
  4520. ^x |
  4521. {0:~ }|
  4522. ]], float_pos=expected_pos}
  4523. else
  4524. screen:expect([[
  4525. ^x |
  4526. {0:~ }|
  4527. {4:[No N}{1:y }{4: }|
  4528. x {2:~ } |
  4529. {0:~ }|
  4530. {5:[No Name] [+] }|
  4531. |
  4532. ]])
  4533. end
  4534. end)
  4535. it("s :split (float)", function()
  4536. feed("<c-w>w<c-w>s")
  4537. if multigrid then
  4538. screen:expect{grid=[[
  4539. ## grid 1
  4540. [5:----------------------------------------]|
  4541. [5:----------------------------------------]|
  4542. {4:[No Name] [+] }|
  4543. [2:----------------------------------------]|
  4544. [2:----------------------------------------]|
  4545. {5:[No Name] [+] }|
  4546. [3:----------------------------------------]|
  4547. ## grid 2
  4548. x |
  4549. {0:~ }|
  4550. ## grid 3
  4551. |
  4552. ## grid 4
  4553. {1:y }|
  4554. {2:~ }|
  4555. ## grid 5
  4556. ^y |
  4557. {0:~ }|
  4558. ]], float_pos=expected_pos}
  4559. else
  4560. screen:expect([[
  4561. ^y |
  4562. {0:~ }|
  4563. {4:[No N}{1:y }{4: }|
  4564. x {2:~ } |
  4565. {0:~ }|
  4566. {5:[No Name] [+] }|
  4567. |
  4568. ]])
  4569. end
  4570. feed("<c-w>j")
  4571. if multigrid then
  4572. screen:expect{grid=[[
  4573. ## grid 1
  4574. [5:----------------------------------------]|
  4575. [5:----------------------------------------]|
  4576. {5:[No Name] [+] }|
  4577. [2:----------------------------------------]|
  4578. [2:----------------------------------------]|
  4579. {4:[No Name] [+] }|
  4580. [3:----------------------------------------]|
  4581. ## grid 2
  4582. ^x |
  4583. {0:~ }|
  4584. ## grid 3
  4585. |
  4586. ## grid 4
  4587. {1:y }|
  4588. {2:~ }|
  4589. ## grid 5
  4590. y |
  4591. {0:~ }|
  4592. ]], float_pos=expected_pos}
  4593. else
  4594. screen:expect([[
  4595. y |
  4596. {0:~ }|
  4597. {5:[No N}{1:y }{5: }|
  4598. ^x {2:~ } |
  4599. {0:~ }|
  4600. {4:[No Name] [+] }|
  4601. |
  4602. ]])
  4603. end
  4604. feed("<c-w>ji")
  4605. if multigrid then
  4606. screen:expect{grid=[[
  4607. ## grid 1
  4608. [5:----------------------------------------]|
  4609. [5:----------------------------------------]|
  4610. {5:[No Name] [+] }|
  4611. [2:----------------------------------------]|
  4612. [2:----------------------------------------]|
  4613. {4:[No Name] [+] }|
  4614. [3:----------------------------------------]|
  4615. ## grid 2
  4616. ^x |
  4617. {0:~ }|
  4618. ## grid 3
  4619. {3:-- INSERT --} |
  4620. ## grid 4
  4621. {1:y }|
  4622. {2:~ }|
  4623. ## grid 5
  4624. y |
  4625. {0:~ }|
  4626. ]], float_pos=expected_pos}
  4627. else
  4628. screen:expect([[
  4629. y |
  4630. {0:~ }|
  4631. {5:[No N}{1:y }{5: }|
  4632. ^x {2:~ } |
  4633. {0:~ }|
  4634. {4:[No Name] [+] }|
  4635. {3:-- INSERT --} |
  4636. ]])
  4637. end
  4638. end)
  4639. it(":new (non-float)", function()
  4640. feed(":new<cr>")
  4641. if multigrid then
  4642. screen:expect{grid=[[
  4643. ## grid 1
  4644. [5:----------------------------------------]|
  4645. [5:----------------------------------------]|
  4646. {4:[No Name] }|
  4647. [2:----------------------------------------]|
  4648. [2:----------------------------------------]|
  4649. {5:[No Name] [+] }|
  4650. [3:----------------------------------------]|
  4651. ## grid 2
  4652. x |
  4653. {0:~ }|
  4654. ## grid 3
  4655. :new |
  4656. ## grid 4
  4657. {1:y }|
  4658. {2:~ }|
  4659. ## grid 5
  4660. ^ |
  4661. {0:~ }|
  4662. ]], float_pos=expected_pos}
  4663. else
  4664. screen:expect([[
  4665. ^ |
  4666. {0:~ }|
  4667. {4:[No N}{1:y }{4: }|
  4668. x {2:~ } |
  4669. {0:~ }|
  4670. {5:[No Name] [+] }|
  4671. :new |
  4672. ]])
  4673. end
  4674. end)
  4675. it(":new (float)", function()
  4676. feed("<c-w>w:new<cr>")
  4677. if multigrid then
  4678. screen:expect{grid=[[
  4679. ## grid 1
  4680. [5:----------------------------------------]|
  4681. [5:----------------------------------------]|
  4682. {4:[No Name] }|
  4683. [2:----------------------------------------]|
  4684. [2:----------------------------------------]|
  4685. {5:[No Name] [+] }|
  4686. [3:----------------------------------------]|
  4687. ## grid 2
  4688. x |
  4689. {0:~ }|
  4690. ## grid 3
  4691. :new |
  4692. ## grid 4
  4693. {1:y }|
  4694. {2:~ }|
  4695. ## grid 5
  4696. ^ |
  4697. {0:~ }|
  4698. ]], float_pos=expected_pos}
  4699. else
  4700. screen:expect([[
  4701. ^ |
  4702. {0:~ }|
  4703. {4:[No N}{1:y }{4: }|
  4704. x {2:~ } |
  4705. {0:~ }|
  4706. {5:[No Name] [+] }|
  4707. :new |
  4708. ]])
  4709. end
  4710. end)
  4711. it("v :vsplit (non-float)", function()
  4712. feed("<c-w>v")
  4713. if multigrid then
  4714. screen:expect{grid=[[
  4715. ## grid 1
  4716. [5:--------------------]{5:│}[2:-------------------]|
  4717. [5:--------------------]{5:│}[2:-------------------]|
  4718. [5:--------------------]{5:│}[2:-------------------]|
  4719. [5:--------------------]{5:│}[2:-------------------]|
  4720. [5:--------------------]{5:│}[2:-------------------]|
  4721. {4:[No Name] [+] }{5:[No Name] [+] }|
  4722. [3:----------------------------------------]|
  4723. ## grid 2
  4724. x |
  4725. {0:~ }|
  4726. {0:~ }|
  4727. {0:~ }|
  4728. {0:~ }|
  4729. ## grid 3
  4730. |
  4731. ## grid 4
  4732. {1:y }|
  4733. {2:~ }|
  4734. ## grid 5
  4735. ^x |
  4736. {0:~ }|
  4737. {0:~ }|
  4738. {0:~ }|
  4739. {0:~ }|
  4740. ]], float_pos=expected_pos}
  4741. else
  4742. screen:expect([[
  4743. ^x {5:│}x |
  4744. {0:~ }{5:│}{0:~ }|
  4745. {0:~ }{1:y }{0: }|
  4746. {0:~ }{2:~ }{0: }|
  4747. {0:~ }{5:│}{0:~ }|
  4748. {4:[No Name] [+] }{5:[No Name] [+] }|
  4749. |
  4750. ]])
  4751. end
  4752. end)
  4753. it(":vnew (non-float)", function()
  4754. feed(":vnew<cr>")
  4755. if multigrid then
  4756. screen:expect{grid=[[
  4757. ## grid 1
  4758. [5:--------------------]{5:│}[2:-------------------]|
  4759. [5:--------------------]{5:│}[2:-------------------]|
  4760. [5:--------------------]{5:│}[2:-------------------]|
  4761. [5:--------------------]{5:│}[2:-------------------]|
  4762. [5:--------------------]{5:│}[2:-------------------]|
  4763. {4:[No Name] }{5:[No Name] [+] }|
  4764. [3:----------------------------------------]|
  4765. ## grid 2
  4766. x |
  4767. {0:~ }|
  4768. {0:~ }|
  4769. {0:~ }|
  4770. {0:~ }|
  4771. ## grid 3
  4772. :vnew |
  4773. ## grid 4
  4774. {1:y }|
  4775. {2:~ }|
  4776. ## grid 5
  4777. ^ |
  4778. {0:~ }|
  4779. {0:~ }|
  4780. {0:~ }|
  4781. {0:~ }|
  4782. ]], float_pos=expected_pos}
  4783. else
  4784. screen:expect([[
  4785. ^ {5:│}x |
  4786. {0:~ }{5:│}{0:~ }|
  4787. {0:~ }{1:y }{0: }|
  4788. {0:~ }{2:~ }{0: }|
  4789. {0:~ }{5:│}{0:~ }|
  4790. {4:[No Name] }{5:[No Name] [+] }|
  4791. :vnew |
  4792. ]])
  4793. end
  4794. end)
  4795. it(":vnew (float)", function()
  4796. feed("<c-w>w:vnew<cr>")
  4797. if multigrid then
  4798. screen:expect{grid=[[
  4799. ## grid 1
  4800. [5:--------------------]{5:│}[2:-------------------]|
  4801. [5:--------------------]{5:│}[2:-------------------]|
  4802. [5:--------------------]{5:│}[2:-------------------]|
  4803. [5:--------------------]{5:│}[2:-------------------]|
  4804. [5:--------------------]{5:│}[2:-------------------]|
  4805. {4:[No Name] }{5:[No Name] [+] }|
  4806. [3:----------------------------------------]|
  4807. ## grid 2
  4808. x |
  4809. {0:~ }|
  4810. {0:~ }|
  4811. {0:~ }|
  4812. {0:~ }|
  4813. ## grid 3
  4814. :vnew |
  4815. ## grid 4
  4816. {1:y }|
  4817. {2:~ }|
  4818. ## grid 5
  4819. ^ |
  4820. {0:~ }|
  4821. {0:~ }|
  4822. {0:~ }|
  4823. {0:~ }|
  4824. ]], float_pos=expected_pos}
  4825. else
  4826. screen:expect([[
  4827. ^ {5:│}x |
  4828. {0:~ }{5:│}{0:~ }|
  4829. {0:~ }{1:y }{0: }|
  4830. {0:~ }{2:~ }{0: }|
  4831. {0:~ }{5:│}{0:~ }|
  4832. {4:[No Name] }{5:[No Name] [+] }|
  4833. :vnew |
  4834. ]])
  4835. end
  4836. end)
  4837. it("q (:quit) last non-float exits nvim", function()
  4838. command('autocmd VimLeave * call rpcrequest(1, "exit")')
  4839. -- avoid unsaved change in other buffer
  4840. feed("<c-w><c-w>:w Xtest_written2<cr><c-w><c-w>")
  4841. -- quit in last non-float
  4842. feed(":wq Xtest_written<cr>")
  4843. local exited = false
  4844. local function on_request(name, args)
  4845. eq("exit", name)
  4846. eq({}, args)
  4847. exited = true
  4848. return 0
  4849. end
  4850. local function on_setup()
  4851. feed(":wq Xtest_written<cr>")
  4852. end
  4853. run(on_request, nil, on_setup)
  4854. os.remove('Xtest_written')
  4855. os.remove('Xtest_written2')
  4856. eq(exited, true)
  4857. end)
  4858. it(':quit two floats in a row', function()
  4859. -- enter first float
  4860. feed('<c-w><c-w>')
  4861. -- enter second float
  4862. meths.open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8})
  4863. if multigrid then
  4864. screen:expect{grid=[[
  4865. ## grid 1
  4866. [2:----------------------------------------]|
  4867. [2:----------------------------------------]|
  4868. [2:----------------------------------------]|
  4869. [2:----------------------------------------]|
  4870. [2:----------------------------------------]|
  4871. [2:----------------------------------------]|
  4872. [3:----------------------------------------]|
  4873. ## grid 2
  4874. x |
  4875. {0:~ }|
  4876. {0:~ }|
  4877. {0:~ }|
  4878. {0:~ }|
  4879. {0:~ }|
  4880. ## grid 3
  4881. |
  4882. ## grid 4
  4883. {1:y }|
  4884. {2:~ }|
  4885. ## grid 5
  4886. {1:^y }|
  4887. {2:~ }|
  4888. ]], float_pos={
  4889. [4] = {{id = 1001}, "NW", 1, 2, 5, true},
  4890. [5] = {{id = 1002}, "NW", 1, 4, 8, true}
  4891. }}
  4892. else
  4893. screen:expect([[
  4894. x |
  4895. {0:~ }|
  4896. {0:~ }{1:y }{0: }|
  4897. {0:~ }{2:~ }{0: }|
  4898. {0:~ }{1:^y }{0: }|
  4899. {0:~ }{2:~ }{0: }|
  4900. |
  4901. ]])
  4902. end
  4903. feed(':quit<cr>')
  4904. if multigrid then
  4905. screen:expect{grid=[[
  4906. ## grid 1
  4907. [2:----------------------------------------]|
  4908. [2:----------------------------------------]|
  4909. [2:----------------------------------------]|
  4910. [2:----------------------------------------]|
  4911. [2:----------------------------------------]|
  4912. {5:[No Name] [+] }|
  4913. [3:----------------------------------------]|
  4914. ## grid 2
  4915. x |
  4916. {0:~ }|
  4917. {0:~ }|
  4918. {0:~ }|
  4919. {0:~ }|
  4920. ## grid 3
  4921. :quit |
  4922. ## grid 4
  4923. {1:^y }|
  4924. {2:~ }|
  4925. ]], float_pos={
  4926. [4] = {{id = 1001}, "NW", 1, 2, 5, true},
  4927. }}
  4928. else
  4929. screen:expect([[
  4930. x |
  4931. {0:~ }|
  4932. {0:~ }{1:^y }{0: }|
  4933. {0:~ }{2:~ }{0: }|
  4934. {0:~ }|
  4935. {5:[No Name] [+] }|
  4936. :quit |
  4937. ]])
  4938. end
  4939. feed(':quit<cr>')
  4940. if multigrid then
  4941. screen:expect([[
  4942. ## grid 1
  4943. [2:----------------------------------------]|
  4944. [2:----------------------------------------]|
  4945. [2:----------------------------------------]|
  4946. [2:----------------------------------------]|
  4947. [2:----------------------------------------]|
  4948. [2:----------------------------------------]|
  4949. [3:----------------------------------------]|
  4950. ## grid 2
  4951. ^x |
  4952. {0:~ }|
  4953. {0:~ }|
  4954. {0:~ }|
  4955. {0:~ }|
  4956. {0:~ }|
  4957. ## grid 3
  4958. :quit |
  4959. ]])
  4960. else
  4961. screen:expect([[
  4962. ^x |
  4963. {0:~ }|
  4964. {0:~ }|
  4965. {0:~ }|
  4966. {0:~ }|
  4967. {0:~ }|
  4968. :quit |
  4969. ]])
  4970. end
  4971. eq(2, eval('1+1'))
  4972. end)
  4973. it("o (:only) non-float", function()
  4974. feed("<c-w>o")
  4975. if multigrid then
  4976. screen:expect{grid=[[
  4977. ## grid 1
  4978. [2:----------------------------------------]|
  4979. [2:----------------------------------------]|
  4980. [2:----------------------------------------]|
  4981. [2:----------------------------------------]|
  4982. [2:----------------------------------------]|
  4983. [2:----------------------------------------]|
  4984. [3:----------------------------------------]|
  4985. ## grid 2
  4986. ^x |
  4987. {0:~ }|
  4988. {0:~ }|
  4989. {0:~ }|
  4990. {0:~ }|
  4991. {0:~ }|
  4992. ## grid 3
  4993. |
  4994. ]]}
  4995. else
  4996. screen:expect([[
  4997. ^x |
  4998. {0:~ }|
  4999. {0:~ }|
  5000. {0:~ }|
  5001. {0:~ }|
  5002. {0:~ }|
  5003. |
  5004. ]])
  5005. end
  5006. end)
  5007. it("o (:only) float fails", function()
  5008. feed("<c-w>w<c-w>o")
  5009. if multigrid then
  5010. screen:expect{grid=[[
  5011. ## grid 1
  5012. [2:----------------------------------------]|
  5013. [2:----------------------------------------]|
  5014. [2:----------------------------------------]|
  5015. [2:----------------------------------------]|
  5016. [3:----------------------------------------]|
  5017. [3:----------------------------------------]|
  5018. [3:----------------------------------------]|
  5019. ## grid 2
  5020. x |
  5021. {0:~ }|
  5022. {0:~ }|
  5023. {0:~ }|
  5024. {0:~ }|
  5025. {0:~ }|
  5026. ## grid 3
  5027. {7:E5601: Cannot close window, only floatin}|
  5028. {7:g window would remain} |
  5029. {8:Press ENTER or type command to continue}^ |
  5030. ## grid 4
  5031. {1:y }|
  5032. {2:~ }|
  5033. ]], float_pos=expected_pos}
  5034. else
  5035. screen:expect([[
  5036. x |
  5037. {0:~ }|
  5038. {0:~ }{1:y }{0: }|
  5039. {4: }|
  5040. {7:E5601: Cannot close window, only floatin}|
  5041. {7:g window would remain} |
  5042. {8:Press ENTER or type command to continue}^ |
  5043. ]])
  5044. end
  5045. -- test message clear
  5046. feed('<cr>')
  5047. if multigrid then
  5048. screen:expect{grid=[[
  5049. ## grid 1
  5050. [2:----------------------------------------]|
  5051. [2:----------------------------------------]|
  5052. [2:----------------------------------------]|
  5053. [2:----------------------------------------]|
  5054. [2:----------------------------------------]|
  5055. [2:----------------------------------------]|
  5056. [3:----------------------------------------]|
  5057. ## grid 2
  5058. x |
  5059. {0:~ }|
  5060. {0:~ }|
  5061. {0:~ }|
  5062. {0:~ }|
  5063. {0:~ }|
  5064. ## grid 3
  5065. |
  5066. ## grid 4
  5067. {1:^y }|
  5068. {2:~ }|
  5069. ]], float_pos=expected_pos}
  5070. else
  5071. screen:expect([[
  5072. x |
  5073. {0:~ }|
  5074. {0:~ }{1:^y }{0: }|
  5075. {0:~ }{2:~ }{0: }|
  5076. {0:~ }|
  5077. {0:~ }|
  5078. |
  5079. ]])
  5080. end
  5081. end)
  5082. it("o (:only) non-float with split", function()
  5083. feed("<c-w>s")
  5084. if multigrid then
  5085. screen:expect{grid=[[
  5086. ## grid 1
  5087. [5:----------------------------------------]|
  5088. [5:----------------------------------------]|
  5089. {4:[No Name] [+] }|
  5090. [2:----------------------------------------]|
  5091. [2:----------------------------------------]|
  5092. {5:[No Name] [+] }|
  5093. [3:----------------------------------------]|
  5094. ## grid 2
  5095. x |
  5096. {0:~ }|
  5097. ## grid 3
  5098. |
  5099. ## grid 4
  5100. {1:y }|
  5101. {2:~ }|
  5102. ## grid 5
  5103. ^x |
  5104. {0:~ }|
  5105. ]], float_pos=expected_pos}
  5106. else
  5107. screen:expect([[
  5108. ^x |
  5109. {0:~ }|
  5110. {4:[No N}{1:y }{4: }|
  5111. x {2:~ } |
  5112. {0:~ }|
  5113. {5:[No Name] [+] }|
  5114. |
  5115. ]])
  5116. end
  5117. feed("<c-w>o")
  5118. if multigrid then
  5119. screen:expect{grid=[[
  5120. ## grid 1
  5121. [5:----------------------------------------]|
  5122. [5:----------------------------------------]|
  5123. [5:----------------------------------------]|
  5124. [5:----------------------------------------]|
  5125. [5:----------------------------------------]|
  5126. [5:----------------------------------------]|
  5127. [3:----------------------------------------]|
  5128. ## grid 3
  5129. |
  5130. ## grid 5
  5131. ^x |
  5132. {0:~ }|
  5133. {0:~ }|
  5134. {0:~ }|
  5135. {0:~ }|
  5136. {0:~ }|
  5137. ]]}
  5138. else
  5139. screen:expect([[
  5140. ^x |
  5141. {0:~ }|
  5142. {0:~ }|
  5143. {0:~ }|
  5144. {0:~ }|
  5145. {0:~ }|
  5146. |
  5147. ]])
  5148. end
  5149. end)
  5150. it("o (:only) float with split", function()
  5151. feed("<c-w>s<c-w>W")
  5152. if multigrid then
  5153. screen:expect{grid=[[
  5154. ## grid 1
  5155. [5:----------------------------------------]|
  5156. [5:----------------------------------------]|
  5157. {5:[No Name] [+] }|
  5158. [2:----------------------------------------]|
  5159. [2:----------------------------------------]|
  5160. {5:[No Name] [+] }|
  5161. [3:----------------------------------------]|
  5162. ## grid 2
  5163. x |
  5164. {0:~ }|
  5165. ## grid 3
  5166. |
  5167. ## grid 4
  5168. {1:^y }|
  5169. {2:~ }|
  5170. ## grid 5
  5171. x |
  5172. {0:~ }|
  5173. ]], float_pos=expected_pos}
  5174. else
  5175. screen:expect([[
  5176. x |
  5177. {0:~ }|
  5178. {5:[No N}{1:^y }{5: }|
  5179. x {2:~ } |
  5180. {0:~ }|
  5181. {5:[No Name] [+] }|
  5182. |
  5183. ]])
  5184. end
  5185. feed("<c-w>o")
  5186. if multigrid then
  5187. screen:expect{grid=[[
  5188. ## grid 1
  5189. [5:----------------------------------------]|
  5190. [5:----------------------------------------]|
  5191. {5:[No Name] [+] }|
  5192. [2:----------------------------------------]|
  5193. [3:----------------------------------------]|
  5194. [3:----------------------------------------]|
  5195. [3:----------------------------------------]|
  5196. ## grid 2
  5197. x |
  5198. {0:~ }|
  5199. ## grid 3
  5200. {7:E5601: Cannot close window, only floatin}|
  5201. {7:g window would remain} |
  5202. {8:Press ENTER or type command to continue}^ |
  5203. ## grid 4
  5204. {1:y }|
  5205. {2:~ }|
  5206. ## grid 5
  5207. x |
  5208. {0:~ }|
  5209. ]], float_pos=expected_pos}
  5210. else
  5211. screen:expect([[
  5212. x |
  5213. {0:~ }|
  5214. {5:[No N}{1:y }{5: }|
  5215. {4: }|
  5216. {7:E5601: Cannot close window, only floatin}|
  5217. {7:g window would remain} |
  5218. {8:Press ENTER or type command to continue}^ |
  5219. ]])
  5220. end
  5221. end)
  5222. it("J (float)", function()
  5223. feed("<c-w>w<c-w>J")
  5224. if multigrid then
  5225. screen:expect{grid=[[
  5226. ## grid 1
  5227. [2:----------------------------------------]|
  5228. [2:----------------------------------------]|
  5229. {5:[No Name] [+] }|
  5230. [4:----------------------------------------]|
  5231. [4:----------------------------------------]|
  5232. {4:[No Name] [+] }|
  5233. [3:----------------------------------------]|
  5234. ## grid 2
  5235. x |
  5236. {0:~ }|
  5237. ## grid 3
  5238. |
  5239. ## grid 4
  5240. ^y |
  5241. {0:~ }|
  5242. ]]}
  5243. else
  5244. screen:expect([[
  5245. x |
  5246. {0:~ }|
  5247. {5:[No Name] [+] }|
  5248. ^y |
  5249. {0:~ }|
  5250. {4:[No Name] [+] }|
  5251. |
  5252. ]])
  5253. end
  5254. if multigrid then
  5255. meths.win_set_config(0, {external=true, width=30, height=2})
  5256. expected_pos = {[4]={external=true}}
  5257. screen:expect{grid=[[
  5258. ## grid 1
  5259. [2:----------------------------------------]|
  5260. [2:----------------------------------------]|
  5261. [2:----------------------------------------]|
  5262. [2:----------------------------------------]|
  5263. [2:----------------------------------------]|
  5264. {5:[No Name] [+] }|
  5265. [3:----------------------------------------]|
  5266. ## grid 2
  5267. x |
  5268. {0:~ }|
  5269. {0:~ }|
  5270. {0:~ }|
  5271. {0:~ }|
  5272. ## grid 3
  5273. |
  5274. ## grid 4
  5275. ^y |
  5276. {0:~ }|
  5277. ]], float_pos=expected_pos}
  5278. else
  5279. eq("UI doesn't support external windows",
  5280. pcall_err(meths.win_set_config, 0, {external=true, width=30, height=2}))
  5281. return
  5282. end
  5283. feed("<c-w>J")
  5284. if multigrid then
  5285. screen:expect([[
  5286. ## grid 1
  5287. [2:----------------------------------------]|
  5288. [2:----------------------------------------]|
  5289. {5:[No Name] [+] }|
  5290. [4:----------------------------------------]|
  5291. [4:----------------------------------------]|
  5292. {4:[No Name] [+] }|
  5293. [3:----------------------------------------]|
  5294. ## grid 2
  5295. x |
  5296. {0:~ }|
  5297. ## grid 3
  5298. |
  5299. ## grid 4
  5300. ^y |
  5301. {0:~ }|
  5302. ]])
  5303. end
  5304. end)
  5305. it('movements with nested split layout', function()
  5306. command("set hidden")
  5307. feed("<c-w>s<c-w>v<c-w>b<c-w>v")
  5308. if multigrid then
  5309. screen:expect{grid=[[
  5310. ## grid 1
  5311. [6:--------------------]{5:│}[5:-------------------]|
  5312. [6:--------------------]{5:│}[5:-------------------]|
  5313. {5:[No Name] [+] [No Name] [+] }|
  5314. [7:--------------------]{5:│}[2:-------------------]|
  5315. [7:--------------------]{5:│}[2:-------------------]|
  5316. {4:[No Name] [+] }{5:[No Name] [+] }|
  5317. [3:----------------------------------------]|
  5318. ## grid 2
  5319. x |
  5320. {0:~ }|
  5321. ## grid 3
  5322. |
  5323. ## grid 4
  5324. {1:y }|
  5325. {2:~ }|
  5326. ## grid 5
  5327. x |
  5328. {0:~ }|
  5329. ## grid 6
  5330. x |
  5331. {0:~ }|
  5332. ## grid 7
  5333. ^x |
  5334. {0:~ }|
  5335. ]], float_pos=expected_pos}
  5336. else
  5337. screen:expect([[
  5338. x {5:│}x |
  5339. {0:~ }{5:│}{0:~ }|
  5340. {5:[No N}{1:y }{5:Name] [+] }|
  5341. ^x {2:~ } |
  5342. {0:~ }{5:│}{0:~ }|
  5343. {4:[No Name] [+] }{5:[No Name] [+] }|
  5344. |
  5345. ]])
  5346. end
  5347. -- verify that N<c-w>w works
  5348. for i = 1,5 do
  5349. feed(i.."<c-w>w")
  5350. feed_command("enew")
  5351. curbufmeths.set_lines(0,-1,true,{tostring(i)})
  5352. end
  5353. if multigrid then
  5354. screen:expect{grid=[[
  5355. ## grid 1
  5356. [6:-------------------]{5:│}[5:--------------------]|
  5357. [6:-------------------]{5:│}[5:--------------------]|
  5358. {5:[No Name] [+] [No Name] [+] }|
  5359. [7:-------------------]{5:│}[2:--------------------]|
  5360. [7:-------------------]{5:│}[2:--------------------]|
  5361. {5:[No Name] [+] [No Name] [+] }|
  5362. [3:----------------------------------------]|
  5363. ## grid 2
  5364. 4 |
  5365. {0:~ }|
  5366. ## grid 3
  5367. :enew |
  5368. ## grid 4
  5369. {1:^5 }|
  5370. {2:~ }|
  5371. ## grid 5
  5372. 2 |
  5373. {0:~ }|
  5374. ## grid 6
  5375. 1 |
  5376. {0:~ }|
  5377. ## grid 7
  5378. 3 |
  5379. {0:~ }|
  5380. ]], float_pos=expected_pos}
  5381. else
  5382. screen:expect([[
  5383. 1 {5:│}2 |
  5384. {0:~ }{5:│}{0:~ }|
  5385. {5:[No N}{1:^5 }{5:ame] [+] }|
  5386. 3 {2:~ } |
  5387. {0:~ }{5:│}{0:~ }|
  5388. {5:[No Name] [+] [No Name] [+] }|
  5389. :enew |
  5390. ]])
  5391. end
  5392. local movements = {
  5393. w={2,3,4,5,1},
  5394. W={5,1,2,3,4},
  5395. h={1,1,3,3,3},
  5396. j={3,3,3,4,4},
  5397. k={1,2,1,1,1},
  5398. l={2,2,4,4,4},
  5399. t={1,1,1,1,1},
  5400. b={4,4,4,4,4},
  5401. }
  5402. for k,v in pairs(movements) do
  5403. for i = 1,5 do
  5404. feed(i.."<c-w>w")
  5405. feed('<c-w>'..k)
  5406. local nr = funcs.winnr()
  5407. eq(v[i],nr, "when using <c-w>"..k.." from window "..i)
  5408. end
  5409. end
  5410. for i = 1,5 do
  5411. feed(i.."<c-w>w")
  5412. for j = 1,5 do
  5413. if j ~= i then
  5414. feed(j.."<c-w>w")
  5415. feed('<c-w>p')
  5416. local nr = funcs.winnr()
  5417. eq(i,nr, "when using <c-w>p to window "..i.." from window "..j)
  5418. end
  5419. end
  5420. end
  5421. end)
  5422. it(":tabnew and :tabnext", function()
  5423. feed(":tabnew<cr>")
  5424. if multigrid then
  5425. -- grid is not freed, but float is marked as closed (should it rather be "invisible"?)
  5426. screen:expect{grid=[[
  5427. ## grid 1
  5428. {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}|
  5429. [5:----------------------------------------]|
  5430. [5:----------------------------------------]|
  5431. [5:----------------------------------------]|
  5432. [5:----------------------------------------]|
  5433. [5:----------------------------------------]|
  5434. [3:----------------------------------------]|
  5435. ## grid 2 (hidden)
  5436. x |
  5437. {0:~ }|
  5438. {0:~ }|
  5439. {0:~ }|
  5440. {0:~ }|
  5441. {0:~ }|
  5442. ## grid 3
  5443. :tabnew |
  5444. ## grid 4 (hidden)
  5445. {1:y }|
  5446. {2:~ }|
  5447. ## grid 5
  5448. ^ |
  5449. {0:~ }|
  5450. {0:~ }|
  5451. {0:~ }|
  5452. {0:~ }|
  5453. ]]}
  5454. else
  5455. screen:expect([[
  5456. {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}|
  5457. ^ |
  5458. {0:~ }|
  5459. {0:~ }|
  5460. {0:~ }|
  5461. {0:~ }|
  5462. :tabnew |
  5463. ]])
  5464. end
  5465. feed(":tabnext<cr>")
  5466. if multigrid then
  5467. screen:expect{grid=[[
  5468. ## grid 1
  5469. {3: }{11:2}{3:+ [No Name] }{9: [No Name] }{5: }{9:X}|
  5470. [2:----------------------------------------]|
  5471. [2:----------------------------------------]|
  5472. [2:----------------------------------------]|
  5473. [2:----------------------------------------]|
  5474. [2:----------------------------------------]|
  5475. [3:----------------------------------------]|
  5476. ## grid 2
  5477. ^x |
  5478. {0:~ }|
  5479. {0:~ }|
  5480. {0:~ }|
  5481. {0:~ }|
  5482. ## grid 3
  5483. :tabnext |
  5484. ## grid 4
  5485. {1:y }|
  5486. {2:~ }|
  5487. ## grid 5 (hidden)
  5488. |
  5489. {0:~ }|
  5490. {0:~ }|
  5491. {0:~ }|
  5492. {0:~ }|
  5493. ]], float_pos=expected_pos}
  5494. else
  5495. screen:expect([[
  5496. {3: }{11:2}{3:+ [No Name] }{9: [No Name] }{5: }{9:X}|
  5497. ^x |
  5498. {0:~ }{1:y }{0: }|
  5499. {0:~ }{2:~ }{0: }|
  5500. {0:~ }|
  5501. {0:~ }|
  5502. :tabnext |
  5503. ]])
  5504. end
  5505. feed(":tabnext<cr>")
  5506. if multigrid then
  5507. screen:expect{grid=[[
  5508. ## grid 1
  5509. {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}|
  5510. [5:----------------------------------------]|
  5511. [5:----------------------------------------]|
  5512. [5:----------------------------------------]|
  5513. [5:----------------------------------------]|
  5514. [5:----------------------------------------]|
  5515. [3:----------------------------------------]|
  5516. ## grid 2 (hidden)
  5517. x |
  5518. {0:~ }|
  5519. {0:~ }|
  5520. {0:~ }|
  5521. {0:~ }|
  5522. ## grid 3
  5523. :tabnext |
  5524. ## grid 4 (hidden)
  5525. {1:y }|
  5526. {2:~ }|
  5527. ## grid 5
  5528. ^ |
  5529. {0:~ }|
  5530. {0:~ }|
  5531. {0:~ }|
  5532. {0:~ }|
  5533. ]]}
  5534. else
  5535. screen:expect([[
  5536. {9: }{10:2}{9:+ [No Name] }{3: [No Name] }{5: }{9:X}|
  5537. ^ |
  5538. {0:~ }|
  5539. {0:~ }|
  5540. {0:~ }|
  5541. {0:~ }|
  5542. :tabnext |
  5543. ]])
  5544. end
  5545. end)
  5546. it(":tabnew and :tabnext (external)", function()
  5547. if multigrid then
  5548. -- also test external window wider than main screen
  5549. meths.win_set_config(win, {external=true, width=65, height=4})
  5550. expected_pos = {[4]={external=true}}
  5551. feed(":tabnew<cr>")
  5552. screen:expect{grid=[[
  5553. ## grid 1
  5554. {9: + [No Name] }{3: }{11:2}{3:+ [No Name] }{5: }{9:X}|
  5555. [5:----------------------------------------]|
  5556. [5:----------------------------------------]|
  5557. [5:----------------------------------------]|
  5558. [5:----------------------------------------]|
  5559. [5:----------------------------------------]|
  5560. [3:----------------------------------------]|
  5561. ## grid 2 (hidden)
  5562. x |
  5563. {0:~ }|
  5564. {0:~ }|
  5565. {0:~ }|
  5566. {0:~ }|
  5567. {0:~ }|
  5568. ## grid 3
  5569. :tabnew |
  5570. ## grid 4
  5571. y |
  5572. {0:~ }|
  5573. {0:~ }|
  5574. {0:~ }|
  5575. ## grid 5
  5576. ^ |
  5577. {0:~ }|
  5578. {0:~ }|
  5579. {0:~ }|
  5580. {0:~ }|
  5581. ]], float_pos=expected_pos}
  5582. else
  5583. eq("UI doesn't support external windows",
  5584. pcall_err(meths.win_set_config, 0, {external=true, width=65, height=4}))
  5585. end
  5586. feed(":tabnext<cr>")
  5587. if multigrid then
  5588. screen:expect{grid=[[
  5589. ## grid 1
  5590. {3: }{11:2}{3:+ [No Name] }{9: [No Name] }{5: }{9:X}|
  5591. [2:----------------------------------------]|
  5592. [2:----------------------------------------]|
  5593. [2:----------------------------------------]|
  5594. [2:----------------------------------------]|
  5595. [2:----------------------------------------]|
  5596. [3:----------------------------------------]|
  5597. ## grid 2
  5598. ^x |
  5599. {0:~ }|
  5600. {0:~ }|
  5601. {0:~ }|
  5602. {0:~ }|
  5603. ## grid 3
  5604. :tabnext |
  5605. ## grid 4
  5606. y |
  5607. {0:~ }|
  5608. {0:~ }|
  5609. {0:~ }|
  5610. ## grid 5 (hidden)
  5611. |
  5612. {0:~ }|
  5613. {0:~ }|
  5614. {0:~ }|
  5615. {0:~ }|
  5616. ]], float_pos=expected_pos}
  5617. end
  5618. feed(":tabnext<cr>")
  5619. if multigrid then
  5620. screen:expect{grid=[[
  5621. ## grid 1
  5622. {9: + [No Name] }{3: }{11:2}{3:+ [No Name] }{5: }{9:X}|
  5623. [5:----------------------------------------]|
  5624. [5:----------------------------------------]|
  5625. [5:----------------------------------------]|
  5626. [5:----------------------------------------]|
  5627. [5:----------------------------------------]|
  5628. [3:----------------------------------------]|
  5629. ## grid 2 (hidden)
  5630. x |
  5631. {0:~ }|
  5632. {0:~ }|
  5633. {0:~ }|
  5634. {0:~ }|
  5635. ## grid 3
  5636. :tabnext |
  5637. ## grid 4
  5638. y |
  5639. {0:~ }|
  5640. {0:~ }|
  5641. {0:~ }|
  5642. ## grid 5
  5643. ^ |
  5644. {0:~ }|
  5645. {0:~ }|
  5646. {0:~ }|
  5647. {0:~ }|
  5648. ]], float_pos=expected_pos}
  5649. end
  5650. end)
  5651. end)
  5652. it("'winblend' option", function()
  5653. screen:try_resize(50,9)
  5654. screen:set_default_attr_ids({
  5655. [1] = {background = Screen.colors.LightMagenta},
  5656. [2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')},
  5657. [3] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')},
  5658. [4] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta},
  5659. [5] = {foreground = tonumber('0x990000'), background = tonumber('0xfff1ff')},
  5660. [6] = {foreground = tonumber('0x332533'), background = tonumber('0xfff1ff')},
  5661. [7] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0x0000d8')},
  5662. [8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1},
  5663. [9] = {background = Screen.colors.LightMagenta, blend=30},
  5664. [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=0},
  5665. [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=80},
  5666. [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend=30},
  5667. })
  5668. insert([[
  5669. Lorem ipsum dolor sit amet, consectetur
  5670. adipisicing elit, sed do eiusmod tempor
  5671. incididunt ut labore et dolore magna aliqua.
  5672. Ut enim ad minim veniam, quis nostrud
  5673. exercitation ullamco laboris nisi ut aliquip ex
  5674. ea commodo consequat. Duis aute irure dolor in
  5675. reprehenderit in voluptate velit esse cillum
  5676. dolore eu fugiat nulla pariatur. Excepteur sint
  5677. occaecat cupidatat non proident, sunt in culpa
  5678. qui officia deserunt mollit anim id est
  5679. laborum.]])
  5680. local buf = meths.create_buf(false,false)
  5681. meths.buf_set_lines(buf, 0, -1, true, {"test", "", "popup text"})
  5682. local win = meths.open_win(buf, false, {relative='editor', width=15, height=3, row=2, col=5})
  5683. if multigrid then
  5684. screen:expect{grid=[[
  5685. ## grid 1
  5686. [2:--------------------------------------------------]|
  5687. [2:--------------------------------------------------]|
  5688. [2:--------------------------------------------------]|
  5689. [2:--------------------------------------------------]|
  5690. [2:--------------------------------------------------]|
  5691. [2:--------------------------------------------------]|
  5692. [2:--------------------------------------------------]|
  5693. [2:--------------------------------------------------]|
  5694. [3:--------------------------------------------------]|
  5695. ## grid 2
  5696. Ut enim ad minim veniam, quis nostrud |
  5697. exercitation ullamco laboris nisi ut aliquip ex |
  5698. ea commodo consequat. Duis aute irure dolor in |
  5699. reprehenderit in voluptate velit esse cillum |
  5700. dolore eu fugiat nulla pariatur. Excepteur sint |
  5701. occaecat cupidatat non proident, sunt in culpa |
  5702. qui officia deserunt mollit anim id est |
  5703. laborum^. |
  5704. ## grid 3
  5705. |
  5706. ## grid 5
  5707. {1:test }|
  5708. {1: }|
  5709. {1:popup text }|
  5710. ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
  5711. else
  5712. screen:expect([[
  5713. Ut enim ad minim veniam, quis nostrud |
  5714. exercitation ullamco laboris nisi ut aliquip ex |
  5715. ea co{1:test }. Duis aute irure dolor in |
  5716. repre{1: }uptate velit esse cillum |
  5717. dolor{1:popup text }la pariatur. Excepteur sint |
  5718. occaecat cupidatat non proident, sunt in culpa |
  5719. qui officia deserunt mollit anim id est |
  5720. laborum^. |
  5721. |
  5722. ]])
  5723. end
  5724. meths.win_set_option(win, "winblend", 30)
  5725. if multigrid then
  5726. screen:expect{grid=[[
  5727. ## grid 1
  5728. [2:--------------------------------------------------]|
  5729. [2:--------------------------------------------------]|
  5730. [2:--------------------------------------------------]|
  5731. [2:--------------------------------------------------]|
  5732. [2:--------------------------------------------------]|
  5733. [2:--------------------------------------------------]|
  5734. [2:--------------------------------------------------]|
  5735. [2:--------------------------------------------------]|
  5736. [3:--------------------------------------------------]|
  5737. ## grid 2
  5738. Ut enim ad minim veniam, quis nostrud |
  5739. exercitation ullamco laboris nisi ut aliquip ex |
  5740. ea commodo consequat. Duis aute irure dolor in |
  5741. reprehenderit in voluptate velit esse cillum |
  5742. dolore eu fugiat nulla pariatur. Excepteur sint |
  5743. occaecat cupidatat non proident, sunt in culpa |
  5744. qui officia deserunt mollit anim id est |
  5745. laborum^. |
  5746. ## grid 3
  5747. |
  5748. ## grid 5
  5749. {9:test }|
  5750. {9: }|
  5751. {9:popup text }|
  5752. ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true}
  5753. else
  5754. screen:expect([[
  5755. Ut enim ad minim veniam, quis nostrud |
  5756. exercitation ullamco laboris nisi ut aliquip ex |
  5757. ea co{2:test}{3:o consequat}. Duis aute irure dolor in |
  5758. repre{3:henderit in vol}uptate velit esse cillum |
  5759. dolor{2:popup}{3:fugi}{2:text}{3:ul}la pariatur. Excepteur sint |
  5760. occaecat cupidatat non proident, sunt in culpa |
  5761. qui officia deserunt mollit anim id est |
  5762. laborum^. |
  5763. |
  5764. ]])
  5765. end
  5766. command('hi SpecialRegion guifg=Red blend=0')
  5767. meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1)
  5768. if multigrid then
  5769. screen:expect{grid=[[
  5770. ## grid 1
  5771. [2:--------------------------------------------------]|
  5772. [2:--------------------------------------------------]|
  5773. [2:--------------------------------------------------]|
  5774. [2:--------------------------------------------------]|
  5775. [2:--------------------------------------------------]|
  5776. [2:--------------------------------------------------]|
  5777. [2:--------------------------------------------------]|
  5778. [2:--------------------------------------------------]|
  5779. [3:--------------------------------------------------]|
  5780. ## grid 2
  5781. Ut enim ad minim veniam, quis nostrud |
  5782. exercitation ullamco laboris nisi ut aliquip ex |
  5783. ea commodo consequat. Duis aute irure dolor in |
  5784. reprehenderit in voluptate velit esse cillum |
  5785. dolore eu fugiat nulla pariatur. Excepteur sint |
  5786. occaecat cupidatat non proident, sunt in culpa |
  5787. qui officia deserunt mollit anim id est |
  5788. laborum^. |
  5789. ## grid 3
  5790. |
  5791. ## grid 5
  5792. {9:test }|
  5793. {9: }|
  5794. {10:popup text}{9: }|
  5795. ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
  5796. else
  5797. screen:expect([[
  5798. Ut enim ad minim veniam, quis nostrud |
  5799. exercitation ullamco laboris nisi ut aliquip ex |
  5800. ea co{2:test}{3:o consequat}. Duis aute irure dolor in |
  5801. repre{3:henderit in vol}uptate velit esse cillum |
  5802. dolor{10:popup text}{3:ul}la pariatur. Excepteur sint |
  5803. occaecat cupidatat non proident, sunt in culpa |
  5804. qui officia deserunt mollit anim id est |
  5805. laborum^. |
  5806. |
  5807. ]])
  5808. end
  5809. command('hi SpecialRegion guifg=Red blend=80')
  5810. if multigrid then
  5811. screen:expect{grid=[[
  5812. ## grid 1
  5813. [2:--------------------------------------------------]|
  5814. [2:--------------------------------------------------]|
  5815. [2:--------------------------------------------------]|
  5816. [2:--------------------------------------------------]|
  5817. [2:--------------------------------------------------]|
  5818. [2:--------------------------------------------------]|
  5819. [2:--------------------------------------------------]|
  5820. [2:--------------------------------------------------]|
  5821. [3:--------------------------------------------------]|
  5822. ## grid 2
  5823. Ut enim ad minim veniam, quis nostrud |
  5824. exercitation ullamco laboris nisi ut aliquip ex |
  5825. ea commodo consequat. Duis aute irure dolor in |
  5826. reprehenderit in voluptate velit esse cillum |
  5827. dolore eu fugiat nulla pariatur. Excepteur sint |
  5828. occaecat cupidatat non proident, sunt in culpa |
  5829. qui officia deserunt mollit anim id est |
  5830. laborum^. |
  5831. ## grid 3
  5832. |
  5833. ## grid 5
  5834. {9:test }|
  5835. {9: }|
  5836. {11:popup text}{9: }|
  5837. ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true}
  5838. else
  5839. screen:expect([[
  5840. Ut enim ad minim veniam, quis nostrud |
  5841. exercitation ullamco laboris nisi ut aliquip ex |
  5842. ea co{2:test}{3:o consequat}. Duis aute irure dolor in |
  5843. repre{3:henderit in vol}uptate velit esse cillum |
  5844. dolor{5:popup}{6:fugi}{5:text}{3:ul}la pariatur. Excepteur sint |
  5845. occaecat cupidatat non proident, sunt in culpa |
  5846. qui officia deserunt mollit anim id est |
  5847. laborum^. |
  5848. |
  5849. ]])
  5850. end
  5851. -- Test scrolling by mouse
  5852. if multigrid then
  5853. meths.input_mouse('wheel', 'down', '', 5, 2, 2)
  5854. screen:expect{grid=[[
  5855. ## grid 1
  5856. [2:--------------------------------------------------]|
  5857. [2:--------------------------------------------------]|
  5858. [2:--------------------------------------------------]|
  5859. [2:--------------------------------------------------]|
  5860. [2:--------------------------------------------------]|
  5861. [2:--------------------------------------------------]|
  5862. [2:--------------------------------------------------]|
  5863. [2:--------------------------------------------------]|
  5864. [3:--------------------------------------------------]|
  5865. ## grid 2
  5866. Ut enim ad minim veniam, quis nostrud |
  5867. exercitation ullamco laboris nisi ut aliquip ex |
  5868. ea commodo consequat. Duis aute irure dolor in |
  5869. reprehenderit in voluptate velit esse cillum |
  5870. dolore eu fugiat nulla pariatur. Excepteur sint |
  5871. occaecat cupidatat non proident, sunt in culpa |
  5872. qui officia deserunt mollit anim id est |
  5873. laborum^. |
  5874. ## grid 3
  5875. |
  5876. ## grid 5
  5877. {11:popup text}{9: }|
  5878. {12:~ }|
  5879. {12:~ }|
  5880. ]], float_pos={[5] = {{id = 1002}, "NW", 1, 2, 5, true}}}
  5881. else
  5882. meths.input_mouse('wheel', 'down', '', 0, 4, 7)
  5883. screen:expect([[
  5884. Ut enim ad minim veniam, quis nostrud |
  5885. exercitation ullamco laboris nisi ut aliquip ex |
  5886. ea co{5:popup}{6: con}{5:text}{3:at}. Duis aute irure dolor in |
  5887. repre{7:~}{3:enderit in vol}uptate velit esse cillum |
  5888. dolor{7:~}{3: eu fugiat nul}la pariatur. Excepteur sint |
  5889. occaecat cupidatat non proident, sunt in culpa |
  5890. qui officia deserunt mollit anim id est |
  5891. laborum^. |
  5892. |
  5893. ]])
  5894. end
  5895. end)
  5896. it('can overlap doublewidth chars', function()
  5897. insert([[
  5898. # TODO: 测试字典信息的准确性
  5899. # FIXME: 测试字典信息的准确性]])
  5900. local buf = meths.create_buf(false,false)
  5901. local win = meths.open_win(buf, false, {relative='editor', width=5, height=3, row=0, col=11, style='minimal'})
  5902. if multigrid then
  5903. screen:expect{grid=[[
  5904. ## grid 1
  5905. [2:----------------------------------------]|
  5906. [2:----------------------------------------]|
  5907. [2:----------------------------------------]|
  5908. [2:----------------------------------------]|
  5909. [2:----------------------------------------]|
  5910. [2:----------------------------------------]|
  5911. [3:----------------------------------------]|
  5912. ## grid 2
  5913. # TODO: 测试字典信息的准确性 |
  5914. # FIXME: 测试字典信息的准确^性 |
  5915. {0:~ }|
  5916. {0:~ }|
  5917. {0:~ }|
  5918. {0:~ }|
  5919. ## grid 3
  5920. |
  5921. ## grid 4
  5922. {1: }|
  5923. {1: }|
  5924. {1: }|
  5925. ]], float_pos={ [4] = { { id = 1001 }, "NW", 1, 0, 11, true } }}
  5926. else
  5927. screen:expect([[
  5928. # TODO: 测 {1: }信息的准确性 |
  5929. # FIXME: 测{1: } 信息的准确^性 |
  5930. {0:~ }{1: }{0: }|
  5931. {0:~ }|
  5932. {0:~ }|
  5933. {0:~ }|
  5934. |
  5935. ]])
  5936. end
  5937. meths.win_close(win, false)
  5938. if multigrid then
  5939. screen:expect([[
  5940. ## grid 1
  5941. [2:----------------------------------------]|
  5942. [2:----------------------------------------]|
  5943. [2:----------------------------------------]|
  5944. [2:----------------------------------------]|
  5945. [2:----------------------------------------]|
  5946. [2:----------------------------------------]|
  5947. [3:----------------------------------------]|
  5948. ## grid 2
  5949. # TODO: 测试字典信息的准确性 |
  5950. # FIXME: 测试字典信息的准确^性 |
  5951. {0:~ }|
  5952. {0:~ }|
  5953. {0:~ }|
  5954. {0:~ }|
  5955. ## grid 3
  5956. |
  5957. ]])
  5958. else
  5959. screen:expect([[
  5960. # TODO: 测试字典信息的准确性 |
  5961. # FIXME: 测试字典信息的准确^性 |
  5962. {0:~ }|
  5963. {0:~ }|
  5964. {0:~ }|
  5965. {0:~ }|
  5966. |
  5967. ]])
  5968. end
  5969. -- The interaction between 'winblend' and doublewidth chars in the background
  5970. -- does not look very good. But check no chars get incorrectly placed
  5971. -- at least. Also check invisible EndOfBuffer region blends correctly.
  5972. meths.buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"})
  5973. win = meths.open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'})
  5974. meths.win_set_option(win, 'winblend', 30)
  5975. screen:set_default_attr_ids({
  5976. [1] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')},
  5977. [2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')},
  5978. [3] = {bold = true, foreground = Screen.colors.Blue1},
  5979. [4] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0xb282ff')},
  5980. [5] = {background = Screen.colors.LightMagenta, blend=30},
  5981. })
  5982. if multigrid then
  5983. screen:expect{grid=[[
  5984. ## grid 1
  5985. [2:----------------------------------------]|
  5986. [2:----------------------------------------]|
  5987. [2:----------------------------------------]|
  5988. [2:----------------------------------------]|
  5989. [2:----------------------------------------]|
  5990. [2:----------------------------------------]|
  5991. [3:----------------------------------------]|
  5992. ## grid 2
  5993. # TODO: 测试字典信息的准确性 |
  5994. # FIXME: 测试字典信息的准确^性 |
  5995. {3:~ }|
  5996. {3:~ }|
  5997. {3:~ }|
  5998. {3:~ }|
  5999. ## grid 3
  6000. |
  6001. ## grid 6
  6002. {5: x x x xx}|
  6003. {5: x x x x}|
  6004. {5: }|
  6005. ]], float_pos={
  6006. [6] = { {
  6007. id = 1003
  6008. }, "NW", 1, 0, 11, true }
  6009. }}
  6010. else
  6011. screen:expect([[
  6012. # TODO: 测 {2: x x x}{1:息}{2: xx} 确性 |
  6013. # FIXME: 测{1:试}{2:x x x}{1:息}{2: x}准确^性 |
  6014. {3:~ }{4: }{3: }|
  6015. {3:~ }|
  6016. {3:~ }|
  6017. {3:~ }|
  6018. |
  6019. ]])
  6020. end
  6021. meths.win_set_config(win, {relative='editor', row=0, col=12})
  6022. if multigrid then
  6023. screen:expect{grid=[[
  6024. ## grid 1
  6025. [2:----------------------------------------]|
  6026. [2:----------------------------------------]|
  6027. [2:----------------------------------------]|
  6028. [2:----------------------------------------]|
  6029. [2:----------------------------------------]|
  6030. [2:----------------------------------------]|
  6031. [3:----------------------------------------]|
  6032. ## grid 2
  6033. # TODO: 测试字典信息的准确性 |
  6034. # FIXME: 测试字典信息的准确^性 |
  6035. {3:~ }|
  6036. {3:~ }|
  6037. {3:~ }|
  6038. {3:~ }|
  6039. ## grid 3
  6040. |
  6041. ## grid 6
  6042. {5: x x x xx}|
  6043. {5: x x x x}|
  6044. {5: }|
  6045. ]], float_pos={
  6046. [6] = { {
  6047. id = 1003
  6048. }, "NW", 1, 0, 12, true }
  6049. }}
  6050. else
  6051. screen:expect([[
  6052. # TODO: 测试{2: x x}{1:信}{2:x }{1:的}{2:xx}确性 |
  6053. # FIXME: 测 {2: x x}{1:信}{2:x }{1:的}{2:x} 确^性 |
  6054. {3:~ }{4: }{3: }|
  6055. {3:~ }|
  6056. {3:~ }|
  6057. {3:~ }|
  6058. |
  6059. ]])
  6060. end
  6061. end)
  6062. it("correctly redraws when overlaid windows are resized #13991", function()
  6063. helpers.source([[
  6064. let popup_config = {"relative" : "editor",
  6065. \ "width" : 7,
  6066. \ "height" : 3,
  6067. \ "row" : 1,
  6068. \ "col" : 1,
  6069. \ "style" : "minimal"}
  6070. let border_config = {"relative" : "editor",
  6071. \ "width" : 9,
  6072. \ "height" : 5,
  6073. \ "row" : 0,
  6074. \ "col" : 0,
  6075. \ "style" : "minimal"}
  6076. let popup_buffer = nvim_create_buf(v:false, v:true)
  6077. let border_buffer = nvim_create_buf(v:false, v:true)
  6078. let popup_win = nvim_open_win(popup_buffer, v:true, popup_config)
  6079. let border_win = nvim_open_win(border_buffer, v:false, border_config)
  6080. call nvim_buf_set_lines(popup_buffer, 0, -1, v:true,
  6081. \ ["long", "longer", "longest"])
  6082. call nvim_buf_set_lines(border_buffer, 0, -1, v:true,
  6083. \ ["---------", "- -", "- -"])
  6084. ]])
  6085. if multigrid then
  6086. screen:expect{grid=[[
  6087. ## grid 1
  6088. [2:----------------------------------------]|
  6089. [2:----------------------------------------]|
  6090. [2:----------------------------------------]|
  6091. [2:----------------------------------------]|
  6092. [2:----------------------------------------]|
  6093. [2:----------------------------------------]|
  6094. [3:----------------------------------------]|
  6095. ## grid 2
  6096. |
  6097. {1:~ }|
  6098. {1:~ }|
  6099. {1:~ }|
  6100. {1:~ }|
  6101. {1:~ }|
  6102. ## grid 3
  6103. |
  6104. ## grid 5
  6105. {2:^long }|
  6106. {2:longer }|
  6107. {2:longest}|
  6108. ## grid 6
  6109. {2:---------}|
  6110. {2:- -}|
  6111. {2:- -}|
  6112. {2: }|
  6113. {2: }|
  6114. ]], attr_ids={
  6115. [1] = {foreground = Screen.colors.Blue1, bold = true};
  6116. [2] = {background = Screen.colors.LightMagenta};
  6117. }, float_pos={
  6118. [5] = { {
  6119. id = 1002
  6120. }, "NW", 1, 1, 1, true },
  6121. [6] = { {
  6122. id = 1003
  6123. }, "NW", 1, 0, 0, true }
  6124. }}
  6125. else
  6126. screen:expect([[
  6127. {1:---------} |
  6128. {1:-^long -}{0: }|
  6129. {1:-longer -}{0: }|
  6130. {1: longest }{0: }|
  6131. {1: }{0: }|
  6132. {0:~ }|
  6133. |
  6134. ]])
  6135. end
  6136. helpers.source([[
  6137. let new_popup_config = {"width" : 1, "height" : 3}
  6138. let new_border_config = {"width" : 3, "height" : 5}
  6139. function! Resize()
  6140. call nvim_win_set_config(g:popup_win, g:new_popup_config)
  6141. call nvim_win_set_config(g:border_win, g:new_border_config)
  6142. call nvim_buf_set_lines(g:border_buffer, 0, -1, v:true,
  6143. \ ["---", "- -", "- -"])
  6144. endfunction
  6145. nnoremap zz <cmd>call Resize()<cr>
  6146. ]])
  6147. helpers.feed("zz")
  6148. if multigrid then
  6149. screen:expect{grid=[[
  6150. ## grid 1
  6151. [2:----------------------------------------]|
  6152. [2:----------------------------------------]|
  6153. [2:----------------------------------------]|
  6154. [2:----------------------------------------]|
  6155. [2:----------------------------------------]|
  6156. [2:----------------------------------------]|
  6157. [3:----------------------------------------]|
  6158. ## grid 2
  6159. |
  6160. {1:~ }|
  6161. {1:~ }|
  6162. {1:~ }|
  6163. {1:~ }|
  6164. {1:~ }|
  6165. ## grid 3
  6166. |
  6167. ## grid 5
  6168. {2:^l}|
  6169. {2:o}|
  6170. {2:n}|
  6171. ## grid 6
  6172. {2:---}|
  6173. {2:- -}|
  6174. {2:- -}|
  6175. {2: }|
  6176. {2: }|
  6177. ]], attr_ids={
  6178. [1] = {foreground = Screen.colors.Blue1, bold = true};
  6179. [2] = {background = Screen.colors.LightMagenta};
  6180. }, float_pos={
  6181. [5] = { {
  6182. id = 1002
  6183. }, "NW", 1, 1, 1, true },
  6184. [6] = { {
  6185. id = 1003
  6186. }, "NW", 1, 0, 0, true }
  6187. }}
  6188. else
  6189. screen:expect([[
  6190. {1:---} |
  6191. {1:-^l-}{0: }|
  6192. {1:-o-}{0: }|
  6193. {1: n }{0: }|
  6194. {1: }{0: }|
  6195. {0:~ }|
  6196. |
  6197. ]])
  6198. end
  6199. end)
  6200. it("correctly orders multiple opened floats (current last)", function()
  6201. local buf = meths.create_buf(false,false)
  6202. local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  6203. meths.win_set_option(win, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
  6204. if multigrid then
  6205. screen:expect{grid=[[
  6206. ## grid 1
  6207. [2:----------------------------------------]|
  6208. [2:----------------------------------------]|
  6209. [2:----------------------------------------]|
  6210. [2:----------------------------------------]|
  6211. [2:----------------------------------------]|
  6212. [2:----------------------------------------]|
  6213. [3:----------------------------------------]|
  6214. ## grid 2
  6215. ^ |
  6216. {0:~ }|
  6217. {0:~ }|
  6218. {0:~ }|
  6219. {0:~ }|
  6220. {0:~ }|
  6221. ## grid 3
  6222. |
  6223. ## grid 4
  6224. {7: }|
  6225. {7:~ }|
  6226. ]], float_pos={
  6227. [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
  6228. }, win_viewport={
  6229. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6230. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6231. }}
  6232. else
  6233. screen:expect{grid=[[
  6234. ^ |
  6235. {0:~ }|
  6236. {0:~ }{7: }{0: }|
  6237. {0:~ }{7:~ }{0: }|
  6238. {0:~ }|
  6239. {0:~ }|
  6240. |
  6241. ]]}
  6242. end
  6243. exec_lua [[
  6244. local buf = vim.api.nvim_create_buf(false,false)
  6245. local win = vim.api.nvim_open_win(buf, false, {relative='editor', width=16, height=2, row=3, col=8})
  6246. vim.api.nvim_win_set_option(win, "winhl", "EndOfBuffer:Normal")
  6247. buf = vim.api.nvim_create_buf(false,false)
  6248. win = vim.api.nvim_open_win(buf, true, {relative='editor', width=12, height=2, row=4, col=10})
  6249. vim.api.nvim_win_set_option(win, "winhl", "Normal:Search,EndOfBuffer:Search")
  6250. ]]
  6251. if multigrid then
  6252. screen:expect{grid=[[
  6253. ## grid 1
  6254. [2:----------------------------------------]|
  6255. [2:----------------------------------------]|
  6256. [2:----------------------------------------]|
  6257. [2:----------------------------------------]|
  6258. [2:----------------------------------------]|
  6259. [2:----------------------------------------]|
  6260. [3:----------------------------------------]|
  6261. ## grid 2
  6262. |
  6263. {0:~ }|
  6264. {0:~ }|
  6265. {0:~ }|
  6266. {0:~ }|
  6267. {0:~ }|
  6268. ## grid 3
  6269. |
  6270. ## grid 4
  6271. {7: }|
  6272. {7:~ }|
  6273. ## grid 5
  6274. {1: }|
  6275. {1:~ }|
  6276. ## grid 6
  6277. {17:^ }|
  6278. {17:~ }|
  6279. ]], float_pos={
  6280. [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
  6281. [5] = { { id = 1002 }, "NW", 1, 3, 8, true };
  6282. [6] = { { id = 1003 }, "NW", 1, 4, 10, true };
  6283. }, win_viewport={
  6284. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6285. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6286. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6287. [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6288. }}
  6289. else
  6290. screen:expect{grid=[[
  6291. |
  6292. {0:~ }|
  6293. {0:~ }{7: }{0: }|
  6294. {0:~ }{7:~ }{1: }{7: }{0: }|
  6295. {0:~ }{1:~ }{17:^ }{1: }{0: }|
  6296. {0:~ }{17:~ }{0: }|
  6297. |
  6298. ]]}
  6299. end
  6300. end)
  6301. it("correctly orders multiple opened floats (non-current last)", function()
  6302. local buf = meths.create_buf(false,false)
  6303. local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
  6304. meths.win_set_option(win, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
  6305. if multigrid then
  6306. screen:expect{grid=[[
  6307. ## grid 1
  6308. [2:----------------------------------------]|
  6309. [2:----------------------------------------]|
  6310. [2:----------------------------------------]|
  6311. [2:----------------------------------------]|
  6312. [2:----------------------------------------]|
  6313. [2:----------------------------------------]|
  6314. [3:----------------------------------------]|
  6315. ## grid 2
  6316. ^ |
  6317. {0:~ }|
  6318. {0:~ }|
  6319. {0:~ }|
  6320. {0:~ }|
  6321. {0:~ }|
  6322. ## grid 3
  6323. |
  6324. ## grid 4
  6325. {7: }|
  6326. {7:~ }|
  6327. ]], float_pos={
  6328. [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
  6329. }, win_viewport={
  6330. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6331. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6332. }}
  6333. else
  6334. screen:expect{grid=[[
  6335. ^ |
  6336. {0:~ }|
  6337. {0:~ }{7: }{0: }|
  6338. {0:~ }{7:~ }{0: }|
  6339. {0:~ }|
  6340. {0:~ }|
  6341. |
  6342. ]]}
  6343. end
  6344. exec_lua [[
  6345. local buf = vim.api.nvim_create_buf(false,false)
  6346. local win = vim.api.nvim_open_win(buf, true, {relative='editor', width=12, height=2, row=4, col=10})
  6347. vim.api.nvim_win_set_option(win, "winhl", "Normal:Search,EndOfBuffer:Search")
  6348. buf = vim.api.nvim_create_buf(false,false)
  6349. win = vim.api.nvim_open_win(buf, false, {relative='editor', width=16, height=2, row=3, col=8})
  6350. vim.api.nvim_win_set_option(win, "winhl", "EndOfBuffer:Normal")
  6351. ]]
  6352. if multigrid then
  6353. screen:expect{grid=[[
  6354. ## grid 1
  6355. [2:----------------------------------------]|
  6356. [2:----------------------------------------]|
  6357. [2:----------------------------------------]|
  6358. [2:----------------------------------------]|
  6359. [2:----------------------------------------]|
  6360. [2:----------------------------------------]|
  6361. [3:----------------------------------------]|
  6362. ## grid 2
  6363. |
  6364. {0:~ }|
  6365. {0:~ }|
  6366. {0:~ }|
  6367. {0:~ }|
  6368. {0:~ }|
  6369. ## grid 3
  6370. |
  6371. ## grid 4
  6372. {7: }|
  6373. {7:~ }|
  6374. ## grid 5
  6375. {17:^ }|
  6376. {17:~ }|
  6377. ## grid 6
  6378. {1: }|
  6379. {1:~ }|
  6380. ]], float_pos={
  6381. [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
  6382. [5] = { { id = 1002 }, "NW", 1, 4, 10, true };
  6383. [6] = { { id = 1003 }, "NW", 1, 3, 8, true };
  6384. }, win_viewport={
  6385. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6386. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6387. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6388. [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6389. }}
  6390. else
  6391. screen:expect{grid=[[
  6392. |
  6393. {0:~ }|
  6394. {0:~ }{7: }{0: }|
  6395. {0:~ }{7:~ }{1: }{7: }{0: }|
  6396. {0:~ }{1:~ }{17:^ }{1: }{0: }|
  6397. {0:~ }{17:~ }{0: }|
  6398. |
  6399. ]]}
  6400. end
  6401. end)
  6402. it('can use z-index', function()
  6403. local buf = meths.create_buf(false,false)
  6404. local win1 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=1, col=5, zindex=30})
  6405. meths.win_set_option(win1, "winhl", "Normal:ErrorMsg,EndOfBuffer:ErrorMsg")
  6406. local win2 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=2, col=6, zindex=50})
  6407. meths.win_set_option(win2, "winhl", "Normal:Search,EndOfBuffer:Search")
  6408. local win3 = meths.open_win(buf, false, {relative='editor', width=20, height=3, row=3, col=7, zindex=40})
  6409. meths.win_set_option(win3, "winhl", "Normal:Question,EndOfBuffer:Question")
  6410. if multigrid then
  6411. screen:expect{grid=[[
  6412. ## grid 1
  6413. [2:----------------------------------------]|
  6414. [2:----------------------------------------]|
  6415. [2:----------------------------------------]|
  6416. [2:----------------------------------------]|
  6417. [2:----------------------------------------]|
  6418. [2:----------------------------------------]|
  6419. [3:----------------------------------------]|
  6420. ## grid 2
  6421. ^ |
  6422. {0:~ }|
  6423. {0:~ }|
  6424. {0:~ }|
  6425. {0:~ }|
  6426. {0:~ }|
  6427. ## grid 3
  6428. |
  6429. ## grid 4
  6430. {7: }|
  6431. {7:~ }|
  6432. {7:~ }|
  6433. ## grid 5
  6434. {17: }|
  6435. {17:~ }|
  6436. {17:~ }|
  6437. ## grid 6
  6438. {8: }|
  6439. {8:~ }|
  6440. {8:~ }|
  6441. ]], float_pos={
  6442. [4] = {{id = 1001}, "NW", 1, 1, 5, true, 30};
  6443. [5] = {{id = 1002}, "NW", 1, 2, 6, true, 50};
  6444. [6] = {{id = 1003}, "NW", 1, 3, 7, true, 40};
  6445. }, win_viewport={
  6446. [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6447. [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6448. [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6449. [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
  6450. }}
  6451. else
  6452. screen:expect{grid=[[
  6453. ^ |
  6454. {0:~ }{7: }{0: }|
  6455. {0:~ }{7:~}{17: }{0: }|
  6456. {0:~ }{7:~}{17:~ }{8: }{0: }|
  6457. {0:~ }{17:~ }{8: }{0: }|
  6458. {0:~ }{8:~ }{0: }|
  6459. |
  6460. ]]}
  6461. end
  6462. end)
  6463. end
  6464. describe('with ext_multigrid', function()
  6465. with_ext_multigrid(true)
  6466. end)
  6467. describe('without ext_multigrid', function()
  6468. with_ext_multigrid(false)
  6469. end)
  6470. end)