multigrid_spec.lua 107 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local clear = helpers.clear
  4. local feed, command, insert = helpers.feed, helpers.command, helpers.insert
  5. local eq = helpers.eq
  6. local meths = helpers.meths
  7. local poke_eventloop = helpers.poke_eventloop
  8. describe('ext_multigrid', function()
  9. local screen
  10. before_each(function()
  11. clear{args_rm={'--headless'}, args={'--cmd', 'set laststatus=2'}}
  12. screen = Screen.new(53,14)
  13. screen:attach({ext_multigrid=true})
  14. screen:set_default_attr_ids({
  15. [1] = {bold = true, foreground = Screen.colors.Blue1},
  16. [2] = {foreground = Screen.colors.Magenta},
  17. [3] = {foreground = Screen.colors.Brown, bold = true},
  18. [4] = {foreground = Screen.colors.SlateBlue},
  19. [5] = {bold = true, foreground = Screen.colors.SlateBlue},
  20. [6] = {foreground = Screen.colors.Cyan4},
  21. [7] = {bold = true},
  22. [8] = {underline = true, bold = true, foreground = Screen.colors.SlateBlue},
  23. [9] = {foreground = Screen.colors.SlateBlue, underline = true},
  24. [10] = {foreground = Screen.colors.Red},
  25. [11] = {bold = true, reverse = true},
  26. [12] = {reverse = true},
  27. [13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
  28. [14] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  29. [15] = {bold = true, foreground = Screen.colors.SeaGreen4},
  30. [16] = {background = Screen.colors.LightGrey, underline = true},
  31. [17] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
  32. [18] = {bold = true, foreground = Screen.colors.Magenta},
  33. [19] = {foreground = Screen.colors.Brown},
  34. })
  35. end)
  36. it('default initial screen', function()
  37. screen:expect{grid=[[
  38. ## grid 1
  39. [2:-----------------------------------------------------]|
  40. [2:-----------------------------------------------------]|
  41. [2:-----------------------------------------------------]|
  42. [2:-----------------------------------------------------]|
  43. [2:-----------------------------------------------------]|
  44. [2:-----------------------------------------------------]|
  45. [2:-----------------------------------------------------]|
  46. [2:-----------------------------------------------------]|
  47. [2:-----------------------------------------------------]|
  48. [2:-----------------------------------------------------]|
  49. [2:-----------------------------------------------------]|
  50. [2:-----------------------------------------------------]|
  51. {11:[No Name] }|
  52. [3:-----------------------------------------------------]|
  53. ## grid 2
  54. ^ |
  55. {1:~ }|
  56. {1:~ }|
  57. {1:~ }|
  58. {1:~ }|
  59. {1:~ }|
  60. {1:~ }|
  61. {1:~ }|
  62. {1:~ }|
  63. {1:~ }|
  64. {1:~ }|
  65. {1:~ }|
  66. ## grid 3
  67. |
  68. ]]}
  69. end)
  70. it('positions windows correctly', function()
  71. command('vsplit')
  72. screen:expect{grid=[[
  73. ## grid 1
  74. [4:--------------------------]{12:│}[2:--------------------------]|
  75. [4:--------------------------]{12:│}[2:--------------------------]|
  76. [4:--------------------------]{12:│}[2:--------------------------]|
  77. [4:--------------------------]{12:│}[2:--------------------------]|
  78. [4:--------------------------]{12:│}[2:--------------------------]|
  79. [4:--------------------------]{12:│}[2:--------------------------]|
  80. [4:--------------------------]{12:│}[2:--------------------------]|
  81. [4:--------------------------]{12:│}[2:--------------------------]|
  82. [4:--------------------------]{12:│}[2:--------------------------]|
  83. [4:--------------------------]{12:│}[2:--------------------------]|
  84. [4:--------------------------]{12:│}[2:--------------------------]|
  85. [4:--------------------------]{12:│}[2:--------------------------]|
  86. {11:[No Name] }{12:[No Name] }|
  87. [3:-----------------------------------------------------]|
  88. ## grid 2
  89. |
  90. {1:~ }|
  91. {1:~ }|
  92. {1:~ }|
  93. {1:~ }|
  94. {1:~ }|
  95. {1:~ }|
  96. {1:~ }|
  97. {1:~ }|
  98. {1:~ }|
  99. {1:~ }|
  100. {1:~ }|
  101. ## grid 3
  102. |
  103. ## grid 4
  104. ^ |
  105. {1:~ }|
  106. {1:~ }|
  107. {1:~ }|
  108. {1:~ }|
  109. {1:~ }|
  110. {1:~ }|
  111. {1:~ }|
  112. {1:~ }|
  113. {1:~ }|
  114. {1:~ }|
  115. {1:~ }|
  116. ]], condition=function()
  117. eq({
  118. [2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 },
  119. [4] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }
  120. }, screen.win_position)
  121. end}
  122. command('wincmd l')
  123. command('split')
  124. screen:expect{grid=[[
  125. ## grid 1
  126. [4:--------------------------]{12:│}[5:--------------------------]|
  127. [4:--------------------------]{12:│}[5:--------------------------]|
  128. [4:--------------------------]{12:│}[5:--------------------------]|
  129. [4:--------------------------]{12:│}[5:--------------------------]|
  130. [4:--------------------------]{12:│}[5:--------------------------]|
  131. [4:--------------------------]{12:│}[5:--------------------------]|
  132. [4:--------------------------]{12:│}{11:[No Name] }|
  133. [4:--------------------------]{12:│}[2:--------------------------]|
  134. [4:--------------------------]{12:│}[2:--------------------------]|
  135. [4:--------------------------]{12:│}[2:--------------------------]|
  136. [4:--------------------------]{12:│}[2:--------------------------]|
  137. [4:--------------------------]{12:│}[2:--------------------------]|
  138. {12:[No Name] [No Name] }|
  139. [3:-----------------------------------------------------]|
  140. ## grid 2
  141. |
  142. {1:~ }|
  143. {1:~ }|
  144. {1:~ }|
  145. {1:~ }|
  146. ## grid 3
  147. |
  148. ## grid 4
  149. |
  150. {1:~ }|
  151. {1:~ }|
  152. {1:~ }|
  153. {1:~ }|
  154. {1:~ }|
  155. {1:~ }|
  156. {1:~ }|
  157. {1:~ }|
  158. {1:~ }|
  159. {1:~ }|
  160. {1:~ }|
  161. ## grid 5
  162. ^ |
  163. {1:~ }|
  164. {1:~ }|
  165. {1:~ }|
  166. {1:~ }|
  167. {1:~ }|
  168. ]], condition=function()
  169. eq({
  170. [2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 },
  171. [4] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 },
  172. [5] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 }
  173. }, screen.win_position)
  174. end}
  175. command('wincmd h')
  176. command('q')
  177. screen:expect{grid=[[
  178. ## grid 1
  179. [5:-----------------------------------------------------]|
  180. [5:-----------------------------------------------------]|
  181. [5:-----------------------------------------------------]|
  182. [5:-----------------------------------------------------]|
  183. [5:-----------------------------------------------------]|
  184. [5:-----------------------------------------------------]|
  185. {11:[No Name] }|
  186. [2:-----------------------------------------------------]|
  187. [2:-----------------------------------------------------]|
  188. [2:-----------------------------------------------------]|
  189. [2:-----------------------------------------------------]|
  190. [2:-----------------------------------------------------]|
  191. {12:[No Name] }|
  192. [3:-----------------------------------------------------]|
  193. ## grid 2
  194. |
  195. {1:~ }|
  196. {1:~ }|
  197. {1:~ }|
  198. {1:~ }|
  199. ## grid 3
  200. |
  201. ## grid 5
  202. ^ |
  203. {1:~ }|
  204. {1:~ }|
  205. {1:~ }|
  206. {1:~ }|
  207. {1:~ }|
  208. ]], condition=function()
  209. eq({
  210. [2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 },
  211. [5] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 }
  212. }, screen.win_position)
  213. end}
  214. end)
  215. describe('split', function ()
  216. describe('horizontally', function ()
  217. it('allocates grids', function ()
  218. command('sp')
  219. screen:expect([[
  220. ## grid 1
  221. [4:-----------------------------------------------------]|
  222. [4:-----------------------------------------------------]|
  223. [4:-----------------------------------------------------]|
  224. [4:-----------------------------------------------------]|
  225. [4:-----------------------------------------------------]|
  226. [4:-----------------------------------------------------]|
  227. {11:[No Name] }|
  228. [2:-----------------------------------------------------]|
  229. [2:-----------------------------------------------------]|
  230. [2:-----------------------------------------------------]|
  231. [2:-----------------------------------------------------]|
  232. [2:-----------------------------------------------------]|
  233. {12:[No Name] }|
  234. [3:-----------------------------------------------------]|
  235. ## grid 2
  236. |
  237. {1:~ }|
  238. {1:~ }|
  239. {1:~ }|
  240. {1:~ }|
  241. ## grid 3
  242. |
  243. ## grid 4
  244. ^ |
  245. {1:~ }|
  246. {1:~ }|
  247. {1:~ }|
  248. {1:~ }|
  249. {1:~ }|
  250. ]])
  251. end)
  252. it('resizes grids', function ()
  253. command('sp')
  254. command('resize 8')
  255. screen:expect([[
  256. ## grid 1
  257. [4:-----------------------------------------------------]|
  258. [4:-----------------------------------------------------]|
  259. [4:-----------------------------------------------------]|
  260. [4:-----------------------------------------------------]|
  261. [4:-----------------------------------------------------]|
  262. [4:-----------------------------------------------------]|
  263. [4:-----------------------------------------------------]|
  264. [4:-----------------------------------------------------]|
  265. {11:[No Name] }|
  266. [2:-----------------------------------------------------]|
  267. [2:-----------------------------------------------------]|
  268. [2:-----------------------------------------------------]|
  269. {12:[No Name] }|
  270. [3:-----------------------------------------------------]|
  271. ## grid 2
  272. |
  273. {1:~ }|
  274. {1:~ }|
  275. ## grid 3
  276. |
  277. ## grid 4
  278. ^ |
  279. {1:~ }|
  280. {1:~ }|
  281. {1:~ }|
  282. {1:~ }|
  283. {1:~ }|
  284. {1:~ }|
  285. {1:~ }|
  286. ]])
  287. end)
  288. it('splits vertically', function()
  289. command('sp')
  290. command('vsp')
  291. command('vsp')
  292. screen:expect{grid=[[
  293. ## grid 1
  294. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  295. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  296. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  297. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  298. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  299. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  300. {11:[No Name] }{12:[No Name] [No Name] }|
  301. [2:-----------------------------------------------------]|
  302. [2:-----------------------------------------------------]|
  303. [2:-----------------------------------------------------]|
  304. [2:-----------------------------------------------------]|
  305. [2:-----------------------------------------------------]|
  306. {12:[No Name] }|
  307. [3:-----------------------------------------------------]|
  308. ## grid 2
  309. |
  310. {1:~ }|
  311. {1:~ }|
  312. {1:~ }|
  313. {1:~ }|
  314. ## grid 3
  315. |
  316. ## grid 4
  317. |
  318. {1:~ }|
  319. {1:~ }|
  320. {1:~ }|
  321. {1:~ }|
  322. {1:~ }|
  323. ## grid 5
  324. |
  325. {1:~ }|
  326. {1:~ }|
  327. {1:~ }|
  328. {1:~ }|
  329. {1:~ }|
  330. ## grid 6
  331. ^ |
  332. {1:~ }|
  333. {1:~ }|
  334. {1:~ }|
  335. {1:~ }|
  336. {1:~ }|
  337. ]]}
  338. insert('hello')
  339. screen:expect{grid=[[
  340. ## grid 1
  341. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  342. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  343. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  344. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  345. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  346. [6:--------------------]{12:│}[5:----------------]{12:│}[4:---------------]|
  347. {11:[No Name] [+] }{12:[No Name] [+] [No Name] [+] }|
  348. [2:-----------------------------------------------------]|
  349. [2:-----------------------------------------------------]|
  350. [2:-----------------------------------------------------]|
  351. [2:-----------------------------------------------------]|
  352. [2:-----------------------------------------------------]|
  353. {12:[No Name] [+] }|
  354. [3:-----------------------------------------------------]|
  355. ## grid 2
  356. hello |
  357. {1:~ }|
  358. {1:~ }|
  359. {1:~ }|
  360. {1:~ }|
  361. ## grid 3
  362. |
  363. ## grid 4
  364. hello |
  365. {1:~ }|
  366. {1:~ }|
  367. {1:~ }|
  368. {1:~ }|
  369. {1:~ }|
  370. ## grid 5
  371. hello |
  372. {1:~ }|
  373. {1:~ }|
  374. {1:~ }|
  375. {1:~ }|
  376. {1:~ }|
  377. ## grid 6
  378. hell^o |
  379. {1:~ }|
  380. {1:~ }|
  381. {1:~ }|
  382. {1:~ }|
  383. {1:~ }|
  384. ]]}
  385. end)
  386. it('closes splits', function ()
  387. command('sp')
  388. screen:expect{grid=[[
  389. ## grid 1
  390. [4:-----------------------------------------------------]|
  391. [4:-----------------------------------------------------]|
  392. [4:-----------------------------------------------------]|
  393. [4:-----------------------------------------------------]|
  394. [4:-----------------------------------------------------]|
  395. [4:-----------------------------------------------------]|
  396. {11:[No Name] }|
  397. [2:-----------------------------------------------------]|
  398. [2:-----------------------------------------------------]|
  399. [2:-----------------------------------------------------]|
  400. [2:-----------------------------------------------------]|
  401. [2:-----------------------------------------------------]|
  402. {12:[No Name] }|
  403. [3:-----------------------------------------------------]|
  404. ## grid 2
  405. |
  406. {1:~ }|
  407. {1:~ }|
  408. {1:~ }|
  409. {1:~ }|
  410. ## grid 3
  411. |
  412. ## grid 4
  413. ^ |
  414. {1:~ }|
  415. {1:~ }|
  416. {1:~ }|
  417. {1:~ }|
  418. {1:~ }|
  419. ]]}
  420. command('q')
  421. screen:expect{grid=[[
  422. ## grid 1
  423. [2:-----------------------------------------------------]|
  424. [2:-----------------------------------------------------]|
  425. [2:-----------------------------------------------------]|
  426. [2:-----------------------------------------------------]|
  427. [2:-----------------------------------------------------]|
  428. [2:-----------------------------------------------------]|
  429. [2:-----------------------------------------------------]|
  430. [2:-----------------------------------------------------]|
  431. [2:-----------------------------------------------------]|
  432. [2:-----------------------------------------------------]|
  433. [2:-----------------------------------------------------]|
  434. [2:-----------------------------------------------------]|
  435. {11:[No Name] }|
  436. [3:-----------------------------------------------------]|
  437. ## grid 2
  438. ^ |
  439. {1:~ }|
  440. {1:~ }|
  441. {1:~ }|
  442. {1:~ }|
  443. {1:~ }|
  444. {1:~ }|
  445. {1:~ }|
  446. {1:~ }|
  447. {1:~ }|
  448. {1:~ }|
  449. {1:~ }|
  450. ## grid 3
  451. |
  452. ]]}
  453. end)
  454. end)
  455. describe('vertically', function ()
  456. it('allocates grids', function ()
  457. command('vsp')
  458. screen:expect{grid=[[
  459. ## grid 1
  460. [4:--------------------------]{12:│}[2:--------------------------]|
  461. [4:--------------------------]{12:│}[2:--------------------------]|
  462. [4:--------------------------]{12:│}[2:--------------------------]|
  463. [4:--------------------------]{12:│}[2:--------------------------]|
  464. [4:--------------------------]{12:│}[2:--------------------------]|
  465. [4:--------------------------]{12:│}[2:--------------------------]|
  466. [4:--------------------------]{12:│}[2:--------------------------]|
  467. [4:--------------------------]{12:│}[2:--------------------------]|
  468. [4:--------------------------]{12:│}[2:--------------------------]|
  469. [4:--------------------------]{12:│}[2:--------------------------]|
  470. [4:--------------------------]{12:│}[2:--------------------------]|
  471. [4:--------------------------]{12:│}[2:--------------------------]|
  472. {11:[No Name] }{12:[No Name] }|
  473. [3:-----------------------------------------------------]|
  474. ## grid 2
  475. |
  476. {1:~ }|
  477. {1:~ }|
  478. {1:~ }|
  479. {1:~ }|
  480. {1:~ }|
  481. {1:~ }|
  482. {1:~ }|
  483. {1:~ }|
  484. {1:~ }|
  485. {1:~ }|
  486. {1:~ }|
  487. ## grid 3
  488. |
  489. ## grid 4
  490. ^ |
  491. {1:~ }|
  492. {1:~ }|
  493. {1:~ }|
  494. {1:~ }|
  495. {1:~ }|
  496. {1:~ }|
  497. {1:~ }|
  498. {1:~ }|
  499. {1:~ }|
  500. {1:~ }|
  501. {1:~ }|
  502. ]]}
  503. end)
  504. it('resizes grids', function ()
  505. command('vsp')
  506. command('vertical resize 10')
  507. screen:expect{grid=[[
  508. ## grid 1
  509. [4:----------]{12:│}[2:------------------------------------------]|
  510. [4:----------]{12:│}[2:------------------------------------------]|
  511. [4:----------]{12:│}[2:------------------------------------------]|
  512. [4:----------]{12:│}[2:------------------------------------------]|
  513. [4:----------]{12:│}[2:------------------------------------------]|
  514. [4:----------]{12:│}[2:------------------------------------------]|
  515. [4:----------]{12:│}[2:------------------------------------------]|
  516. [4:----------]{12:│}[2:------------------------------------------]|
  517. [4:----------]{12:│}[2:------------------------------------------]|
  518. [4:----------]{12:│}[2:------------------------------------------]|
  519. [4:----------]{12:│}[2:------------------------------------------]|
  520. [4:----------]{12:│}[2:------------------------------------------]|
  521. {11:<No Name] }{12:[No Name] }|
  522. [3:-----------------------------------------------------]|
  523. ## grid 2
  524. |
  525. {1:~ }|
  526. {1:~ }|
  527. {1:~ }|
  528. {1:~ }|
  529. {1:~ }|
  530. {1:~ }|
  531. {1:~ }|
  532. {1:~ }|
  533. {1:~ }|
  534. {1:~ }|
  535. {1:~ }|
  536. ## grid 3
  537. |
  538. ## grid 4
  539. ^ |
  540. {1:~ }|
  541. {1:~ }|
  542. {1:~ }|
  543. {1:~ }|
  544. {1:~ }|
  545. {1:~ }|
  546. {1:~ }|
  547. {1:~ }|
  548. {1:~ }|
  549. {1:~ }|
  550. {1:~ }|
  551. ]]}
  552. end)
  553. it('splits horizontally', function ()
  554. command('vsp')
  555. command('sp')
  556. screen:expect{grid=[[
  557. ## grid 1
  558. [5:--------------------------]{12:│}[2:--------------------------]|
  559. [5:--------------------------]{12:│}[2:--------------------------]|
  560. [5:--------------------------]{12:│}[2:--------------------------]|
  561. [5:--------------------------]{12:│}[2:--------------------------]|
  562. [5:--------------------------]{12:│}[2:--------------------------]|
  563. [5:--------------------------]{12:│}[2:--------------------------]|
  564. {11:[No Name] }{12:│}[2:--------------------------]|
  565. [4:--------------------------]{12:│}[2:--------------------------]|
  566. [4:--------------------------]{12:│}[2:--------------------------]|
  567. [4:--------------------------]{12:│}[2:--------------------------]|
  568. [4:--------------------------]{12:│}[2:--------------------------]|
  569. [4:--------------------------]{12:│}[2:--------------------------]|
  570. {12:[No Name] [No Name] }|
  571. [3:-----------------------------------------------------]|
  572. ## grid 2
  573. |
  574. {1:~ }|
  575. {1:~ }|
  576. {1:~ }|
  577. {1:~ }|
  578. {1:~ }|
  579. {1:~ }|
  580. {1:~ }|
  581. {1:~ }|
  582. {1:~ }|
  583. {1:~ }|
  584. {1:~ }|
  585. ## grid 3
  586. |
  587. ## grid 4
  588. |
  589. {1:~ }|
  590. {1:~ }|
  591. {1:~ }|
  592. {1:~ }|
  593. ## grid 5
  594. ^ |
  595. {1:~ }|
  596. {1:~ }|
  597. {1:~ }|
  598. {1:~ }|
  599. {1:~ }|
  600. ]]}
  601. insert('hello')
  602. screen:expect{grid=[[
  603. ## grid 1
  604. [5:--------------------------]{12:│}[2:--------------------------]|
  605. [5:--------------------------]{12:│}[2:--------------------------]|
  606. [5:--------------------------]{12:│}[2:--------------------------]|
  607. [5:--------------------------]{12:│}[2:--------------------------]|
  608. [5:--------------------------]{12:│}[2:--------------------------]|
  609. [5:--------------------------]{12:│}[2:--------------------------]|
  610. {11:[No Name] [+] }{12:│}[2:--------------------------]|
  611. [4:--------------------------]{12:│}[2:--------------------------]|
  612. [4:--------------------------]{12:│}[2:--------------------------]|
  613. [4:--------------------------]{12:│}[2:--------------------------]|
  614. [4:--------------------------]{12:│}[2:--------------------------]|
  615. [4:--------------------------]{12:│}[2:--------------------------]|
  616. {12:[No Name] [+] [No Name] [+] }|
  617. [3:-----------------------------------------------------]|
  618. ## grid 2
  619. hello |
  620. {1:~ }|
  621. {1:~ }|
  622. {1:~ }|
  623. {1:~ }|
  624. {1:~ }|
  625. {1:~ }|
  626. {1:~ }|
  627. {1:~ }|
  628. {1:~ }|
  629. {1:~ }|
  630. {1:~ }|
  631. ## grid 3
  632. |
  633. ## grid 4
  634. hello |
  635. {1:~ }|
  636. {1:~ }|
  637. {1:~ }|
  638. {1:~ }|
  639. ## grid 5
  640. hell^o |
  641. {1:~ }|
  642. {1:~ }|
  643. {1:~ }|
  644. {1:~ }|
  645. {1:~ }|
  646. ]]}
  647. end)
  648. it('closes splits', function ()
  649. command('vsp')
  650. screen:expect{grid=[[
  651. ## grid 1
  652. [4:--------------------------]{12:│}[2:--------------------------]|
  653. [4:--------------------------]{12:│}[2:--------------------------]|
  654. [4:--------------------------]{12:│}[2:--------------------------]|
  655. [4:--------------------------]{12:│}[2:--------------------------]|
  656. [4:--------------------------]{12:│}[2:--------------------------]|
  657. [4:--------------------------]{12:│}[2:--------------------------]|
  658. [4:--------------------------]{12:│}[2:--------------------------]|
  659. [4:--------------------------]{12:│}[2:--------------------------]|
  660. [4:--------------------------]{12:│}[2:--------------------------]|
  661. [4:--------------------------]{12:│}[2:--------------------------]|
  662. [4:--------------------------]{12:│}[2:--------------------------]|
  663. [4:--------------------------]{12:│}[2:--------------------------]|
  664. {11:[No Name] }{12:[No Name] }|
  665. [3:-----------------------------------------------------]|
  666. ## grid 2
  667. |
  668. {1:~ }|
  669. {1:~ }|
  670. {1:~ }|
  671. {1:~ }|
  672. {1:~ }|
  673. {1:~ }|
  674. {1:~ }|
  675. {1:~ }|
  676. {1:~ }|
  677. {1:~ }|
  678. {1:~ }|
  679. ## grid 3
  680. |
  681. ## grid 4
  682. ^ |
  683. {1:~ }|
  684. {1:~ }|
  685. {1:~ }|
  686. {1:~ }|
  687. {1:~ }|
  688. {1:~ }|
  689. {1:~ }|
  690. {1:~ }|
  691. {1:~ }|
  692. {1:~ }|
  693. {1:~ }|
  694. ]]}
  695. command('q')
  696. screen:expect{grid=[[
  697. ## grid 1
  698. [2:-----------------------------------------------------]|
  699. [2:-----------------------------------------------------]|
  700. [2:-----------------------------------------------------]|
  701. [2:-----------------------------------------------------]|
  702. [2:-----------------------------------------------------]|
  703. [2:-----------------------------------------------------]|
  704. [2:-----------------------------------------------------]|
  705. [2:-----------------------------------------------------]|
  706. [2:-----------------------------------------------------]|
  707. [2:-----------------------------------------------------]|
  708. [2:-----------------------------------------------------]|
  709. [2:-----------------------------------------------------]|
  710. {11:[No Name] }|
  711. [3:-----------------------------------------------------]|
  712. ## grid 2
  713. ^ |
  714. {1:~ }|
  715. {1:~ }|
  716. {1:~ }|
  717. {1:~ }|
  718. {1:~ }|
  719. {1:~ }|
  720. {1:~ }|
  721. {1:~ }|
  722. {1:~ }|
  723. {1:~ }|
  724. {1:~ }|
  725. ## grid 3
  726. |
  727. ]]}
  728. end)
  729. end)
  730. end)
  731. describe('on resize', function ()
  732. it('rebuilds all grids', function ()
  733. screen:try_resize(25, 6)
  734. screen:expect{grid=[[
  735. ## grid 1
  736. [2:-------------------------]|
  737. [2:-------------------------]|
  738. [2:-------------------------]|
  739. [2:-------------------------]|
  740. {11:[No Name] }|
  741. [3:-------------------------]|
  742. ## grid 2
  743. ^ |
  744. {1:~ }|
  745. {1:~ }|
  746. {1:~ }|
  747. ## grid 3
  748. |
  749. ]]}
  750. end)
  751. it('has minimum width/height values', function()
  752. screen:try_resize(1, 1)
  753. screen:expect{grid=[[
  754. ## grid 1
  755. [2:------------]|
  756. {11:[No Name] }|
  757. [3:------------]|
  758. ## grid 2
  759. ^ |
  760. ## grid 3
  761. |
  762. ]]}
  763. feed('<esc>:ls')
  764. screen:expect{grid=[[
  765. ## grid 1
  766. [2:------------]|
  767. {11:[No Name] }|
  768. [3:------------]|
  769. ## grid 2
  770. |
  771. ## grid 3
  772. :ls^ |
  773. ]]}
  774. end)
  775. end)
  776. describe('grid of smaller inner size', function()
  777. it('is rendered correctly', function()
  778. screen:try_resize_grid(2, 8, 5)
  779. screen:expect{grid=[[
  780. ## grid 1
  781. [2:-----------------------------------------------------]|
  782. [2:-----------------------------------------------------]|
  783. [2:-----------------------------------------------------]|
  784. [2:-----------------------------------------------------]|
  785. [2:-----------------------------------------------------]|
  786. [2:-----------------------------------------------------]|
  787. [2:-----------------------------------------------------]|
  788. [2:-----------------------------------------------------]|
  789. [2:-----------------------------------------------------]|
  790. [2:-----------------------------------------------------]|
  791. [2:-----------------------------------------------------]|
  792. [2:-----------------------------------------------------]|
  793. {11:[No Name] }|
  794. [3:-----------------------------------------------------]|
  795. ## grid 2
  796. ^ |
  797. {1:~ }|
  798. {1:~ }|
  799. {1:~ }|
  800. {1:~ }|
  801. ## grid 3
  802. |
  803. ]]}
  804. end)
  805. end)
  806. describe('grid of bigger inner size', function()
  807. it('is rendered correctly', function()
  808. screen:try_resize_grid(2, 80, 20)
  809. screen:expect{grid=[[
  810. ## grid 1
  811. [2:-----------------------------------------------------]|
  812. [2:-----------------------------------------------------]|
  813. [2:-----------------------------------------------------]|
  814. [2:-----------------------------------------------------]|
  815. [2:-----------------------------------------------------]|
  816. [2:-----------------------------------------------------]|
  817. [2:-----------------------------------------------------]|
  818. [2:-----------------------------------------------------]|
  819. [2:-----------------------------------------------------]|
  820. [2:-----------------------------------------------------]|
  821. [2:-----------------------------------------------------]|
  822. [2:-----------------------------------------------------]|
  823. {11:[No Name] }|
  824. [3:-----------------------------------------------------]|
  825. ## grid 2
  826. ^ |
  827. {1:~ }|
  828. {1:~ }|
  829. {1:~ }|
  830. {1:~ }|
  831. {1:~ }|
  832. {1:~ }|
  833. {1:~ }|
  834. {1:~ }|
  835. {1:~ }|
  836. {1:~ }|
  837. {1:~ }|
  838. {1:~ }|
  839. {1:~ }|
  840. {1:~ }|
  841. {1:~ }|
  842. {1:~ }|
  843. {1:~ }|
  844. {1:~ }|
  845. {1:~ }|
  846. ## grid 3
  847. |
  848. ]]}
  849. end)
  850. end)
  851. describe('with resized grid', function()
  852. before_each(function()
  853. screen:try_resize_grid(2, 60, 20)
  854. end)
  855. it('gets written till grid width', function()
  856. insert(('a'):rep(60).."\n")
  857. screen:expect{grid=[[
  858. ## grid 1
  859. [2:-----------------------------------------------------]|
  860. [2:-----------------------------------------------------]|
  861. [2:-----------------------------------------------------]|
  862. [2:-----------------------------------------------------]|
  863. [2:-----------------------------------------------------]|
  864. [2:-----------------------------------------------------]|
  865. [2:-----------------------------------------------------]|
  866. [2:-----------------------------------------------------]|
  867. [2:-----------------------------------------------------]|
  868. [2:-----------------------------------------------------]|
  869. [2:-----------------------------------------------------]|
  870. [2:-----------------------------------------------------]|
  871. {11:[No Name] [+] }|
  872. [3:-----------------------------------------------------]|
  873. ## grid 2
  874. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
  875. ^ |
  876. {1:~ }|
  877. {1:~ }|
  878. {1:~ }|
  879. {1:~ }|
  880. {1:~ }|
  881. {1:~ }|
  882. {1:~ }|
  883. {1:~ }|
  884. {1:~ }|
  885. {1:~ }|
  886. {1:~ }|
  887. {1:~ }|
  888. {1:~ }|
  889. {1:~ }|
  890. {1:~ }|
  891. {1:~ }|
  892. {1:~ }|
  893. {1:~ }|
  894. ## grid 3
  895. |
  896. ]]}
  897. end)
  898. it('wraps with grid width', function()
  899. insert(('b'):rep(80).."\n")
  900. screen:expect{grid=[[
  901. ## grid 1
  902. [2:-----------------------------------------------------]|
  903. [2:-----------------------------------------------------]|
  904. [2:-----------------------------------------------------]|
  905. [2:-----------------------------------------------------]|
  906. [2:-----------------------------------------------------]|
  907. [2:-----------------------------------------------------]|
  908. [2:-----------------------------------------------------]|
  909. [2:-----------------------------------------------------]|
  910. [2:-----------------------------------------------------]|
  911. [2:-----------------------------------------------------]|
  912. [2:-----------------------------------------------------]|
  913. [2:-----------------------------------------------------]|
  914. {11:[No Name] [+] }|
  915. [3:-----------------------------------------------------]|
  916. ## grid 2
  917. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
  918. bbbbbbbbbbbbbbbbbbbb |
  919. ^ |
  920. {1:~ }|
  921. {1:~ }|
  922. {1:~ }|
  923. {1:~ }|
  924. {1:~ }|
  925. {1:~ }|
  926. {1:~ }|
  927. {1:~ }|
  928. {1:~ }|
  929. {1:~ }|
  930. {1:~ }|
  931. {1:~ }|
  932. {1:~ }|
  933. {1:~ }|
  934. {1:~ }|
  935. {1:~ }|
  936. {1:~ }|
  937. ## grid 3
  938. |
  939. ]]}
  940. end)
  941. it('displays messages with default grid width', function()
  942. command('echomsg "this is a very very very very very very very very'..
  943. ' long message"')
  944. screen:expect{grid=[[
  945. ## grid 1
  946. [2:-----------------------------------------------------]|
  947. [2:-----------------------------------------------------]|
  948. [2:-----------------------------------------------------]|
  949. [2:-----------------------------------------------------]|
  950. [2:-----------------------------------------------------]|
  951. [2:-----------------------------------------------------]|
  952. [2:-----------------------------------------------------]|
  953. [2:-----------------------------------------------------]|
  954. [2:-----------------------------------------------------]|
  955. [2:-----------------------------------------------------]|
  956. [2:-----------------------------------------------------]|
  957. [2:-----------------------------------------------------]|
  958. {11:[No Name] }|
  959. [3:-----------------------------------------------------]|
  960. ## grid 2
  961. ^ |
  962. {1:~ }|
  963. {1:~ }|
  964. {1:~ }|
  965. {1:~ }|
  966. {1:~ }|
  967. {1:~ }|
  968. {1:~ }|
  969. {1:~ }|
  970. {1:~ }|
  971. {1:~ }|
  972. {1:~ }|
  973. {1:~ }|
  974. {1:~ }|
  975. {1:~ }|
  976. {1:~ }|
  977. {1:~ }|
  978. {1:~ }|
  979. {1:~ }|
  980. {1:~ }|
  981. ## grid 3
  982. this is a very very very...ry very very long message |
  983. ]]}
  984. end)
  985. it('creates folds with grid width', function()
  986. insert('this is a fold\nthis is inside fold\nthis is outside fold')
  987. feed('kzfgg')
  988. screen:expect{grid=[[
  989. ## grid 1
  990. [2:-----------------------------------------------------]|
  991. [2:-----------------------------------------------------]|
  992. [2:-----------------------------------------------------]|
  993. [2:-----------------------------------------------------]|
  994. [2:-----------------------------------------------------]|
  995. [2:-----------------------------------------------------]|
  996. [2:-----------------------------------------------------]|
  997. [2:-----------------------------------------------------]|
  998. [2:-----------------------------------------------------]|
  999. [2:-----------------------------------------------------]|
  1000. [2:-----------------------------------------------------]|
  1001. [2:-----------------------------------------------------]|
  1002. {11:[No Name] [+] }|
  1003. [3:-----------------------------------------------------]|
  1004. ## grid 2
  1005. {13:^+-- 2 lines: this is a fold································}|
  1006. this is outside fold |
  1007. {1:~ }|
  1008. {1:~ }|
  1009. {1:~ }|
  1010. {1:~ }|
  1011. {1:~ }|
  1012. {1:~ }|
  1013. {1:~ }|
  1014. {1:~ }|
  1015. {1:~ }|
  1016. {1:~ }|
  1017. {1:~ }|
  1018. {1:~ }|
  1019. {1:~ }|
  1020. {1:~ }|
  1021. {1:~ }|
  1022. {1:~ }|
  1023. {1:~ }|
  1024. {1:~ }|
  1025. ## grid 3
  1026. |
  1027. ]]}
  1028. end)
  1029. end)
  1030. it('multiline messages scroll over windows', function()
  1031. command('sp')
  1032. command('vsp')
  1033. screen:expect{grid=[[
  1034. ## grid 1
  1035. [5:--------------------------]{12:│}[4:--------------------------]|
  1036. [5:--------------------------]{12:│}[4:--------------------------]|
  1037. [5:--------------------------]{12:│}[4:--------------------------]|
  1038. [5:--------------------------]{12:│}[4:--------------------------]|
  1039. [5:--------------------------]{12:│}[4:--------------------------]|
  1040. [5:--------------------------]{12:│}[4:--------------------------]|
  1041. {11:[No Name] }{12:[No Name] }|
  1042. [2:-----------------------------------------------------]|
  1043. [2:-----------------------------------------------------]|
  1044. [2:-----------------------------------------------------]|
  1045. [2:-----------------------------------------------------]|
  1046. [2:-----------------------------------------------------]|
  1047. {12:[No Name] }|
  1048. [3:-----------------------------------------------------]|
  1049. ## grid 2
  1050. |
  1051. {1:~ }|
  1052. {1:~ }|
  1053. {1:~ }|
  1054. {1:~ }|
  1055. ## grid 3
  1056. |
  1057. ## grid 4
  1058. |
  1059. {1:~ }|
  1060. {1:~ }|
  1061. {1:~ }|
  1062. {1:~ }|
  1063. {1:~ }|
  1064. ## grid 5
  1065. ^ |
  1066. {1:~ }|
  1067. {1:~ }|
  1068. {1:~ }|
  1069. {1:~ }|
  1070. {1:~ }|
  1071. ]]}
  1072. feed(":echoerr 'very' | echoerr 'much' | echoerr 'fail'<cr>")
  1073. screen:expect{grid=[[
  1074. ## grid 1
  1075. [5:--------------------------]{12:│}[4:--------------------------]|
  1076. [5:--------------------------]{12:│}[4:--------------------------]|
  1077. [5:--------------------------]{12:│}[4:--------------------------]|
  1078. [5:--------------------------]{12:│}[4:--------------------------]|
  1079. [5:--------------------------]{12:│}[4:--------------------------]|
  1080. [5:--------------------------]{12:│}[4:--------------------------]|
  1081. {11:[No Name] }{12:[No Name] }|
  1082. [2:-----------------------------------------------------]|
  1083. [2:-----------------------------------------------------]|
  1084. [2:-----------------------------------------------------]|
  1085. [3:-----------------------------------------------------]|
  1086. [3:-----------------------------------------------------]|
  1087. [3:-----------------------------------------------------]|
  1088. [3:-----------------------------------------------------]|
  1089. ## grid 2
  1090. |
  1091. {1:~ }|
  1092. {1:~ }|
  1093. {1:~ }|
  1094. {1:~ }|
  1095. ## grid 3
  1096. {14:very} |
  1097. {14:much} |
  1098. {14:fail} |
  1099. {15:Press ENTER or type command to continue}^ |
  1100. ## grid 4
  1101. |
  1102. {1:~ }|
  1103. {1:~ }|
  1104. {1:~ }|
  1105. {1:~ }|
  1106. {1:~ }|
  1107. ## grid 5
  1108. |
  1109. {1:~ }|
  1110. {1:~ }|
  1111. {1:~ }|
  1112. {1:~ }|
  1113. {1:~ }|
  1114. ]]}
  1115. feed('<cr>')
  1116. screen:expect{grid=[[
  1117. ## grid 1
  1118. [5:--------------------------]{12:│}[4:--------------------------]|
  1119. [5:--------------------------]{12:│}[4:--------------------------]|
  1120. [5:--------------------------]{12:│}[4:--------------------------]|
  1121. [5:--------------------------]{12:│}[4:--------------------------]|
  1122. [5:--------------------------]{12:│}[4:--------------------------]|
  1123. [5:--------------------------]{12:│}[4:--------------------------]|
  1124. {11:[No Name] }{12:[No Name] }|
  1125. [2:-----------------------------------------------------]|
  1126. [2:-----------------------------------------------------]|
  1127. [2:-----------------------------------------------------]|
  1128. [2:-----------------------------------------------------]|
  1129. [2:-----------------------------------------------------]|
  1130. {12:[No Name] }|
  1131. [3:-----------------------------------------------------]|
  1132. ## grid 2
  1133. |
  1134. {1:~ }|
  1135. {1:~ }|
  1136. {1:~ }|
  1137. {1:~ }|
  1138. ## grid 3
  1139. |
  1140. ## grid 4
  1141. |
  1142. {1:~ }|
  1143. {1:~ }|
  1144. {1:~ }|
  1145. {1:~ }|
  1146. {1:~ }|
  1147. ## grid 5
  1148. ^ |
  1149. {1:~ }|
  1150. {1:~ }|
  1151. {1:~ }|
  1152. {1:~ }|
  1153. {1:~ }|
  1154. ]]}
  1155. command([[
  1156. func! ErrMsg()
  1157. for i in range(11)
  1158. echoerr "error ".i
  1159. endfor
  1160. endfunc]])
  1161. feed(":call ErrMsg()<cr>")
  1162. screen:expect{grid=[[
  1163. ## grid 1
  1164. [3:-----------------------------------------------------]|
  1165. [3:-----------------------------------------------------]|
  1166. [3:-----------------------------------------------------]|
  1167. [3:-----------------------------------------------------]|
  1168. [3:-----------------------------------------------------]|
  1169. [3:-----------------------------------------------------]|
  1170. [3:-----------------------------------------------------]|
  1171. [3:-----------------------------------------------------]|
  1172. [3:-----------------------------------------------------]|
  1173. [3:-----------------------------------------------------]|
  1174. [3:-----------------------------------------------------]|
  1175. [3:-----------------------------------------------------]|
  1176. [3:-----------------------------------------------------]|
  1177. [3:-----------------------------------------------------]|
  1178. ## grid 2
  1179. |
  1180. {1:~ }|
  1181. {1:~ }|
  1182. {1:~ }|
  1183. {1:~ }|
  1184. ## grid 3
  1185. {14:Error detected while processing function ErrMsg:} |
  1186. {19:line 2:} |
  1187. {14:error 0} |
  1188. {14:error 1} |
  1189. {14:error 2} |
  1190. {14:error 3} |
  1191. {14:error 4} |
  1192. {14:error 5} |
  1193. {14:error 6} |
  1194. {14:error 7} |
  1195. {14:error 8} |
  1196. {14:error 9} |
  1197. {14:error 10} |
  1198. {15:Press ENTER or type command to continue}^ |
  1199. ## grid 4
  1200. |
  1201. {1:~ }|
  1202. {1:~ }|
  1203. {1:~ }|
  1204. {1:~ }|
  1205. {1:~ }|
  1206. ## grid 5
  1207. |
  1208. {1:~ }|
  1209. {1:~ }|
  1210. {1:~ }|
  1211. {1:~ }|
  1212. {1:~ }|
  1213. ]]}
  1214. feed("<c-c>")
  1215. screen:expect{grid=[[
  1216. ## grid 1
  1217. [5:--------------------------]{12:│}[4:--------------------------]|
  1218. [5:--------------------------]{12:│}[4:--------------------------]|
  1219. [5:--------------------------]{12:│}[4:--------------------------]|
  1220. [5:--------------------------]{12:│}[4:--------------------------]|
  1221. [5:--------------------------]{12:│}[4:--------------------------]|
  1222. [5:--------------------------]{12:│}[4:--------------------------]|
  1223. {11:[No Name] }{12:[No Name] }|
  1224. [2:-----------------------------------------------------]|
  1225. [2:-----------------------------------------------------]|
  1226. [2:-----------------------------------------------------]|
  1227. [2:-----------------------------------------------------]|
  1228. [2:-----------------------------------------------------]|
  1229. {12:[No Name] }|
  1230. [3:-----------------------------------------------------]|
  1231. ## grid 2
  1232. |
  1233. {1:~ }|
  1234. {1:~ }|
  1235. {1:~ }|
  1236. {1:~ }|
  1237. ## grid 3
  1238. |
  1239. ## grid 4
  1240. |
  1241. {1:~ }|
  1242. {1:~ }|
  1243. {1:~ }|
  1244. {1:~ }|
  1245. {1:~ }|
  1246. ## grid 5
  1247. ^ |
  1248. {1:~ }|
  1249. {1:~ }|
  1250. {1:~ }|
  1251. {1:~ }|
  1252. {1:~ }|
  1253. ]]}
  1254. end)
  1255. it('handles switch tabs', function()
  1256. command('vsp')
  1257. screen:expect{grid=[[
  1258. ## grid 1
  1259. [4:--------------------------]{12:│}[2:--------------------------]|
  1260. [4:--------------------------]{12:│}[2:--------------------------]|
  1261. [4:--------------------------]{12:│}[2:--------------------------]|
  1262. [4:--------------------------]{12:│}[2:--------------------------]|
  1263. [4:--------------------------]{12:│}[2:--------------------------]|
  1264. [4:--------------------------]{12:│}[2:--------------------------]|
  1265. [4:--------------------------]{12:│}[2:--------------------------]|
  1266. [4:--------------------------]{12:│}[2:--------------------------]|
  1267. [4:--------------------------]{12:│}[2:--------------------------]|
  1268. [4:--------------------------]{12:│}[2:--------------------------]|
  1269. [4:--------------------------]{12:│}[2:--------------------------]|
  1270. [4:--------------------------]{12:│}[2:--------------------------]|
  1271. {11:[No Name] }{12:[No Name] }|
  1272. [3:-----------------------------------------------------]|
  1273. ## grid 2
  1274. |
  1275. {1:~ }|
  1276. {1:~ }|
  1277. {1:~ }|
  1278. {1:~ }|
  1279. {1:~ }|
  1280. {1:~ }|
  1281. {1:~ }|
  1282. {1:~ }|
  1283. {1:~ }|
  1284. {1:~ }|
  1285. {1:~ }|
  1286. ## grid 3
  1287. |
  1288. ## grid 4
  1289. ^ |
  1290. {1:~ }|
  1291. {1:~ }|
  1292. {1:~ }|
  1293. {1:~ }|
  1294. {1:~ }|
  1295. {1:~ }|
  1296. {1:~ }|
  1297. {1:~ }|
  1298. {1:~ }|
  1299. {1:~ }|
  1300. {1:~ }|
  1301. ]]}
  1302. command('tabnew')
  1303. -- note the old grids aren't resized yet
  1304. screen:expect{grid=[[
  1305. ## grid 1
  1306. {16: }{17:2}{16: [No Name] }{7: [No Name] }{12: }{16:X}|
  1307. [5:-----------------------------------------------------]|
  1308. [5:-----------------------------------------------------]|
  1309. [5:-----------------------------------------------------]|
  1310. [5:-----------------------------------------------------]|
  1311. [5:-----------------------------------------------------]|
  1312. [5:-----------------------------------------------------]|
  1313. [5:-----------------------------------------------------]|
  1314. [5:-----------------------------------------------------]|
  1315. [5:-----------------------------------------------------]|
  1316. [5:-----------------------------------------------------]|
  1317. [5:-----------------------------------------------------]|
  1318. {11:[No Name] }|
  1319. [3:-----------------------------------------------------]|
  1320. ## grid 2 (hidden)
  1321. |
  1322. {1:~ }|
  1323. {1:~ }|
  1324. {1:~ }|
  1325. {1:~ }|
  1326. {1:~ }|
  1327. {1:~ }|
  1328. {1:~ }|
  1329. {1:~ }|
  1330. {1:~ }|
  1331. {1:~ }|
  1332. {1:~ }|
  1333. ## grid 3
  1334. |
  1335. ## grid 4 (hidden)
  1336. |
  1337. {1:~ }|
  1338. {1:~ }|
  1339. {1:~ }|
  1340. {1:~ }|
  1341. {1:~ }|
  1342. {1:~ }|
  1343. {1:~ }|
  1344. {1:~ }|
  1345. {1:~ }|
  1346. {1:~ }|
  1347. {1:~ }|
  1348. ## grid 5
  1349. ^ |
  1350. {1:~ }|
  1351. {1:~ }|
  1352. {1:~ }|
  1353. {1:~ }|
  1354. {1:~ }|
  1355. {1:~ }|
  1356. {1:~ }|
  1357. {1:~ }|
  1358. {1:~ }|
  1359. {1:~ }|
  1360. ]]}
  1361. command('sp')
  1362. screen:expect{grid=[[
  1363. ## grid 1
  1364. {16: }{17:2}{16: [No Name] }{7: }{18:2}{7: [No Name] }{12: }{16:X}|
  1365. [6:-----------------------------------------------------]|
  1366. [6:-----------------------------------------------------]|
  1367. [6:-----------------------------------------------------]|
  1368. [6:-----------------------------------------------------]|
  1369. [6:-----------------------------------------------------]|
  1370. {11:[No Name] }|
  1371. [5:-----------------------------------------------------]|
  1372. [5:-----------------------------------------------------]|
  1373. [5:-----------------------------------------------------]|
  1374. [5:-----------------------------------------------------]|
  1375. [5:-----------------------------------------------------]|
  1376. {12:[No Name] }|
  1377. [3:-----------------------------------------------------]|
  1378. ## grid 2 (hidden)
  1379. |
  1380. {1:~ }|
  1381. {1:~ }|
  1382. {1:~ }|
  1383. {1:~ }|
  1384. {1:~ }|
  1385. {1:~ }|
  1386. {1:~ }|
  1387. {1:~ }|
  1388. {1:~ }|
  1389. {1:~ }|
  1390. {1:~ }|
  1391. ## grid 3
  1392. |
  1393. ## grid 4 (hidden)
  1394. |
  1395. {1:~ }|
  1396. {1:~ }|
  1397. {1:~ }|
  1398. {1:~ }|
  1399. {1:~ }|
  1400. {1:~ }|
  1401. {1:~ }|
  1402. {1:~ }|
  1403. {1:~ }|
  1404. {1:~ }|
  1405. {1:~ }|
  1406. ## grid 5
  1407. |
  1408. {1:~ }|
  1409. {1:~ }|
  1410. {1:~ }|
  1411. {1:~ }|
  1412. ## grid 6
  1413. ^ |
  1414. {1:~ }|
  1415. {1:~ }|
  1416. {1:~ }|
  1417. {1:~ }|
  1418. ]]}
  1419. command('tabnext')
  1420. screen:expect{grid=[[
  1421. ## grid 1
  1422. {7: }{18:2}{7: [No Name] }{16: }{17:2}{16: [No Name] }{12: }{16:X}|
  1423. [4:--------------------------]{12:│}[2:--------------------------]|
  1424. [4:--------------------------]{12:│}[2:--------------------------]|
  1425. [4:--------------------------]{12:│}[2:--------------------------]|
  1426. [4:--------------------------]{12:│}[2:--------------------------]|
  1427. [4:--------------------------]{12:│}[2:--------------------------]|
  1428. [4:--------------------------]{12:│}[2:--------------------------]|
  1429. [4:--------------------------]{12:│}[2:--------------------------]|
  1430. [4:--------------------------]{12:│}[2:--------------------------]|
  1431. [4:--------------------------]{12:│}[2:--------------------------]|
  1432. [4:--------------------------]{12:│}[2:--------------------------]|
  1433. [4:--------------------------]{12:│}[2:--------------------------]|
  1434. {11:[No Name] }{12:[No Name] }|
  1435. [3:-----------------------------------------------------]|
  1436. ## grid 2
  1437. |
  1438. {1:~ }|
  1439. {1:~ }|
  1440. {1:~ }|
  1441. {1:~ }|
  1442. {1:~ }|
  1443. {1:~ }|
  1444. {1:~ }|
  1445. {1:~ }|
  1446. {1:~ }|
  1447. {1:~ }|
  1448. ## grid 3
  1449. |
  1450. ## grid 4
  1451. ^ |
  1452. {1:~ }|
  1453. {1:~ }|
  1454. {1:~ }|
  1455. {1:~ }|
  1456. {1:~ }|
  1457. {1:~ }|
  1458. {1:~ }|
  1459. {1:~ }|
  1460. {1:~ }|
  1461. {1:~ }|
  1462. ## grid 5 (hidden)
  1463. |
  1464. {1:~ }|
  1465. {1:~ }|
  1466. {1:~ }|
  1467. {1:~ }|
  1468. ## grid 6 (hidden)
  1469. |
  1470. {1:~ }|
  1471. {1:~ }|
  1472. {1:~ }|
  1473. {1:~ }|
  1474. ]]}
  1475. command('tabnext')
  1476. screen:expect{grid=[[
  1477. ## grid 1
  1478. {16: }{17:2}{16: [No Name] }{7: }{18:2}{7: [No Name] }{12: }{16:X}|
  1479. [6:-----------------------------------------------------]|
  1480. [6:-----------------------------------------------------]|
  1481. [6:-----------------------------------------------------]|
  1482. [6:-----------------------------------------------------]|
  1483. [6:-----------------------------------------------------]|
  1484. {11:[No Name] }|
  1485. [5:-----------------------------------------------------]|
  1486. [5:-----------------------------------------------------]|
  1487. [5:-----------------------------------------------------]|
  1488. [5:-----------------------------------------------------]|
  1489. [5:-----------------------------------------------------]|
  1490. {12:[No Name] }|
  1491. [3:-----------------------------------------------------]|
  1492. ## grid 2 (hidden)
  1493. |
  1494. {1:~ }|
  1495. {1:~ }|
  1496. {1:~ }|
  1497. {1:~ }|
  1498. {1:~ }|
  1499. {1:~ }|
  1500. {1:~ }|
  1501. {1:~ }|
  1502. {1:~ }|
  1503. {1:~ }|
  1504. ## grid 3
  1505. |
  1506. ## grid 4 (hidden)
  1507. |
  1508. {1:~ }|
  1509. {1:~ }|
  1510. {1:~ }|
  1511. {1:~ }|
  1512. {1:~ }|
  1513. {1:~ }|
  1514. {1:~ }|
  1515. {1:~ }|
  1516. {1:~ }|
  1517. {1:~ }|
  1518. ## grid 5
  1519. |
  1520. {1:~ }|
  1521. {1:~ }|
  1522. {1:~ }|
  1523. {1:~ }|
  1524. ## grid 6
  1525. ^ |
  1526. {1:~ }|
  1527. {1:~ }|
  1528. {1:~ }|
  1529. {1:~ }|
  1530. ]]}
  1531. command('tabnext')
  1532. command('$tabnew')
  1533. screen:expect{grid=[[
  1534. ## grid 1
  1535. {16: }{17:2}{16: [No Name] }{17:2}{16: [No Name] }{7: [No Name] }{12: }{16:X}|
  1536. [7:-----------------------------------------------------]|
  1537. [7:-----------------------------------------------------]|
  1538. [7:-----------------------------------------------------]|
  1539. [7:-----------------------------------------------------]|
  1540. [7:-----------------------------------------------------]|
  1541. [7:-----------------------------------------------------]|
  1542. [7:-----------------------------------------------------]|
  1543. [7:-----------------------------------------------------]|
  1544. [7:-----------------------------------------------------]|
  1545. [7:-----------------------------------------------------]|
  1546. [7:-----------------------------------------------------]|
  1547. {11:[No Name] }|
  1548. [3:-----------------------------------------------------]|
  1549. ## grid 2 (hidden)
  1550. |
  1551. {1:~ }|
  1552. {1:~ }|
  1553. {1:~ }|
  1554. {1:~ }|
  1555. {1:~ }|
  1556. {1:~ }|
  1557. {1:~ }|
  1558. {1:~ }|
  1559. {1:~ }|
  1560. {1:~ }|
  1561. ## grid 3
  1562. |
  1563. ## grid 4 (hidden)
  1564. |
  1565. {1:~ }|
  1566. {1:~ }|
  1567. {1:~ }|
  1568. {1:~ }|
  1569. {1:~ }|
  1570. {1:~ }|
  1571. {1:~ }|
  1572. {1:~ }|
  1573. {1:~ }|
  1574. {1:~ }|
  1575. ## grid 5 (hidden)
  1576. |
  1577. {1:~ }|
  1578. {1:~ }|
  1579. {1:~ }|
  1580. {1:~ }|
  1581. ## grid 6 (hidden)
  1582. |
  1583. {1:~ }|
  1584. {1:~ }|
  1585. {1:~ }|
  1586. {1:~ }|
  1587. ## grid 7
  1588. ^ |
  1589. {1:~ }|
  1590. {1:~ }|
  1591. {1:~ }|
  1592. {1:~ }|
  1593. {1:~ }|
  1594. {1:~ }|
  1595. {1:~ }|
  1596. {1:~ }|
  1597. {1:~ }|
  1598. {1:~ }|
  1599. ]]}
  1600. command('tabclose')
  1601. command('tabclose')
  1602. screen:expect{grid=[[
  1603. ## grid 1
  1604. [4:--------------------------]{12:│}[2:--------------------------]|
  1605. [4:--------------------------]{12:│}[2:--------------------------]|
  1606. [4:--------------------------]{12:│}[2:--------------------------]|
  1607. [4:--------------------------]{12:│}[2:--------------------------]|
  1608. [4:--------------------------]{12:│}[2:--------------------------]|
  1609. [4:--------------------------]{12:│}[2:--------------------------]|
  1610. [4:--------------------------]{12:│}[2:--------------------------]|
  1611. [4:--------------------------]{12:│}[2:--------------------------]|
  1612. [4:--------------------------]{12:│}[2:--------------------------]|
  1613. [4:--------------------------]{12:│}[2:--------------------------]|
  1614. [4:--------------------------]{12:│}[2:--------------------------]|
  1615. [4:--------------------------]{12:│}[2:--------------------------]|
  1616. {11:[No Name] }{12:[No Name] }|
  1617. [3:-----------------------------------------------------]|
  1618. ## grid 2
  1619. |
  1620. {1:~ }|
  1621. {1:~ }|
  1622. {1:~ }|
  1623. {1:~ }|
  1624. {1:~ }|
  1625. {1:~ }|
  1626. {1:~ }|
  1627. {1:~ }|
  1628. {1:~ }|
  1629. {1:~ }|
  1630. {1:~ }|
  1631. ## grid 3
  1632. |
  1633. ## grid 4
  1634. ^ |
  1635. {1:~ }|
  1636. {1:~ }|
  1637. {1:~ }|
  1638. {1:~ }|
  1639. {1:~ }|
  1640. {1:~ }|
  1641. {1:~ }|
  1642. {1:~ }|
  1643. {1:~ }|
  1644. {1:~ }|
  1645. {1:~ }|
  1646. ]]}
  1647. end)
  1648. it('supports mouse', function()
  1649. insert('some text\nto be clicked')
  1650. screen:expect{grid=[[
  1651. ## grid 1
  1652. [2:-----------------------------------------------------]|
  1653. [2:-----------------------------------------------------]|
  1654. [2:-----------------------------------------------------]|
  1655. [2:-----------------------------------------------------]|
  1656. [2:-----------------------------------------------------]|
  1657. [2:-----------------------------------------------------]|
  1658. [2:-----------------------------------------------------]|
  1659. [2:-----------------------------------------------------]|
  1660. [2:-----------------------------------------------------]|
  1661. [2:-----------------------------------------------------]|
  1662. [2:-----------------------------------------------------]|
  1663. [2:-----------------------------------------------------]|
  1664. {11:[No Name] [+] }|
  1665. [3:-----------------------------------------------------]|
  1666. ## grid 2
  1667. some text |
  1668. to be clicke^d |
  1669. {1:~ }|
  1670. {1:~ }|
  1671. {1:~ }|
  1672. {1:~ }|
  1673. {1:~ }|
  1674. {1:~ }|
  1675. {1:~ }|
  1676. {1:~ }|
  1677. {1:~ }|
  1678. {1:~ }|
  1679. ## grid 3
  1680. |
  1681. ]]}
  1682. meths.input_mouse('left', 'press', '', 2, 0, 5)
  1683. screen:expect{grid=[[
  1684. ## grid 1
  1685. [2:-----------------------------------------------------]|
  1686. [2:-----------------------------------------------------]|
  1687. [2:-----------------------------------------------------]|
  1688. [2:-----------------------------------------------------]|
  1689. [2:-----------------------------------------------------]|
  1690. [2:-----------------------------------------------------]|
  1691. [2:-----------------------------------------------------]|
  1692. [2:-----------------------------------------------------]|
  1693. [2:-----------------------------------------------------]|
  1694. [2:-----------------------------------------------------]|
  1695. [2:-----------------------------------------------------]|
  1696. [2:-----------------------------------------------------]|
  1697. {11:[No Name] [+] }|
  1698. [3:-----------------------------------------------------]|
  1699. ## grid 2
  1700. some ^text |
  1701. to be clicked |
  1702. {1:~ }|
  1703. {1:~ }|
  1704. {1:~ }|
  1705. {1:~ }|
  1706. {1:~ }|
  1707. {1:~ }|
  1708. {1:~ }|
  1709. {1:~ }|
  1710. {1:~ }|
  1711. {1:~ }|
  1712. ## grid 3
  1713. |
  1714. ]]}
  1715. feed(':new<cr>')
  1716. insert('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo')
  1717. screen:expect{grid=[[
  1718. ## grid 1
  1719. [4:-----------------------------------------------------]|
  1720. [4:-----------------------------------------------------]|
  1721. [4:-----------------------------------------------------]|
  1722. [4:-----------------------------------------------------]|
  1723. [4:-----------------------------------------------------]|
  1724. [4:-----------------------------------------------------]|
  1725. {11:[No Name] [+] }|
  1726. [2:-----------------------------------------------------]|
  1727. [2:-----------------------------------------------------]|
  1728. [2:-----------------------------------------------------]|
  1729. [2:-----------------------------------------------------]|
  1730. [2:-----------------------------------------------------]|
  1731. {12:[No Name] [+] }|
  1732. [3:-----------------------------------------------------]|
  1733. ## grid 2
  1734. some text |
  1735. to be clicked |
  1736. {1:~ }|
  1737. {1:~ }|
  1738. {1:~ }|
  1739. ## grid 3
  1740. |
  1741. ## grid 4
  1742. Lorem ipsum dolor sit amet, consectetur adipiscing el|
  1743. it, sed do eiusm^o |
  1744. {1:~ }|
  1745. {1:~ }|
  1746. {1:~ }|
  1747. {1:~ }|
  1748. ]]}
  1749. meths.input_mouse('left', 'press', '', 2, 1, 6)
  1750. screen:expect{grid=[[
  1751. ## grid 1
  1752. [4:-----------------------------------------------------]|
  1753. [4:-----------------------------------------------------]|
  1754. [4:-----------------------------------------------------]|
  1755. [4:-----------------------------------------------------]|
  1756. [4:-----------------------------------------------------]|
  1757. [4:-----------------------------------------------------]|
  1758. {12:[No Name] [+] }|
  1759. [2:-----------------------------------------------------]|
  1760. [2:-----------------------------------------------------]|
  1761. [2:-----------------------------------------------------]|
  1762. [2:-----------------------------------------------------]|
  1763. [2:-----------------------------------------------------]|
  1764. {11:[No Name] [+] }|
  1765. [3:-----------------------------------------------------]|
  1766. ## grid 2
  1767. some text |
  1768. to be ^clicked |
  1769. {1:~ }|
  1770. {1:~ }|
  1771. {1:~ }|
  1772. ## grid 3
  1773. |
  1774. ## grid 4
  1775. Lorem ipsum dolor sit amet, consectetur adipiscing el|
  1776. it, sed do eiusmo |
  1777. {1:~ }|
  1778. {1:~ }|
  1779. {1:~ }|
  1780. {1:~ }|
  1781. ]]}
  1782. meths.input_mouse('left', 'press', '', 4, 1, 4)
  1783. screen:expect{grid=[[
  1784. ## grid 1
  1785. [4:-----------------------------------------------------]|
  1786. [4:-----------------------------------------------------]|
  1787. [4:-----------------------------------------------------]|
  1788. [4:-----------------------------------------------------]|
  1789. [4:-----------------------------------------------------]|
  1790. [4:-----------------------------------------------------]|
  1791. {11:[No Name] [+] }|
  1792. [2:-----------------------------------------------------]|
  1793. [2:-----------------------------------------------------]|
  1794. [2:-----------------------------------------------------]|
  1795. [2:-----------------------------------------------------]|
  1796. [2:-----------------------------------------------------]|
  1797. {12:[No Name] [+] }|
  1798. [3:-----------------------------------------------------]|
  1799. ## grid 2
  1800. some text |
  1801. to be clicked |
  1802. {1:~ }|
  1803. {1:~ }|
  1804. {1:~ }|
  1805. ## grid 3
  1806. |
  1807. ## grid 4
  1808. Lorem ipsum dolor sit amet, consectetur adipiscing el|
  1809. it, ^sed do eiusmo |
  1810. {1:~ }|
  1811. {1:~ }|
  1812. {1:~ }|
  1813. {1:~ }|
  1814. ]]}
  1815. screen:try_resize_grid(4, 80, 2)
  1816. screen:expect{grid=[[
  1817. ## grid 1
  1818. [4:-----------------------------------------------------]|
  1819. [4:-----------------------------------------------------]|
  1820. [4:-----------------------------------------------------]|
  1821. [4:-----------------------------------------------------]|
  1822. [4:-----------------------------------------------------]|
  1823. [4:-----------------------------------------------------]|
  1824. {11:[No Name] [+] }|
  1825. [2:-----------------------------------------------------]|
  1826. [2:-----------------------------------------------------]|
  1827. [2:-----------------------------------------------------]|
  1828. [2:-----------------------------------------------------]|
  1829. [2:-----------------------------------------------------]|
  1830. {12:[No Name] [+] }|
  1831. [3:-----------------------------------------------------]|
  1832. ## grid 2
  1833. some text |
  1834. to be clicked |
  1835. {1:~ }|
  1836. {1:~ }|
  1837. {1:~ }|
  1838. ## grid 3
  1839. |
  1840. ## grid 4
  1841. Lorem ipsum dolor sit amet, consectetur adipiscing elit, ^sed do eiusmo |
  1842. {1:~ }|
  1843. ]]}
  1844. meths.input_mouse('left', 'press', '', 4, 0, 64)
  1845. screen:expect{grid=[[
  1846. ## grid 1
  1847. [4:-----------------------------------------------------]|
  1848. [4:-----------------------------------------------------]|
  1849. [4:-----------------------------------------------------]|
  1850. [4:-----------------------------------------------------]|
  1851. [4:-----------------------------------------------------]|
  1852. [4:-----------------------------------------------------]|
  1853. {11:[No Name] [+] }|
  1854. [2:-----------------------------------------------------]|
  1855. [2:-----------------------------------------------------]|
  1856. [2:-----------------------------------------------------]|
  1857. [2:-----------------------------------------------------]|
  1858. [2:-----------------------------------------------------]|
  1859. {12:[No Name] [+] }|
  1860. [3:-----------------------------------------------------]|
  1861. ## grid 2
  1862. some text |
  1863. to be clicked |
  1864. {1:~ }|
  1865. {1:~ }|
  1866. {1:~ }|
  1867. ## grid 3
  1868. |
  1869. ## grid 4
  1870. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
  1871. {1:~ }|
  1872. ]]}
  1873. meths.input_mouse('left', 'press', '', 1,6, 20)
  1874. -- TODO(bfredl): "batching" input_mouse is formally not supported yet.
  1875. -- Normally it should work fine in async context when nvim is not blocked,
  1876. -- but add a poke_eventloop be sure.
  1877. poke_eventloop()
  1878. meths.input_mouse('left', 'drag', '', 1, 4, 20)
  1879. screen:expect{grid=[[
  1880. ## grid 1
  1881. [4:-----------------------------------------------------]|
  1882. [4:-----------------------------------------------------]|
  1883. [4:-----------------------------------------------------]|
  1884. [4:-----------------------------------------------------]|
  1885. {11:[No Name] [+] }|
  1886. [2:-----------------------------------------------------]|
  1887. [2:-----------------------------------------------------]|
  1888. [2:-----------------------------------------------------]|
  1889. [2:-----------------------------------------------------]|
  1890. [2:-----------------------------------------------------]|
  1891. [2:-----------------------------------------------------]|
  1892. [2:-----------------------------------------------------]|
  1893. {12:[No Name] [+] }|
  1894. [3:-----------------------------------------------------]|
  1895. ## grid 2
  1896. some text |
  1897. to be clicked |
  1898. {1:~ }|
  1899. {1:~ }|
  1900. {1:~ }|
  1901. {1:~ }|
  1902. {1:~ }|
  1903. ## grid 3
  1904. |
  1905. ## grid 4
  1906. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
  1907. {1:~ }|
  1908. ]]}
  1909. feed('<c-w><c-w><c-w>v')
  1910. screen:expect{grid=[[
  1911. ## grid 1
  1912. [4:-----------------------------------------------------]|
  1913. [4:-----------------------------------------------------]|
  1914. [4:-----------------------------------------------------]|
  1915. [4:-----------------------------------------------------]|
  1916. {12:[No Name] [+] }|
  1917. [5:--------------------------]{12:│}[2:--------------------------]|
  1918. [5:--------------------------]{12:│}[2:--------------------------]|
  1919. [5:--------------------------]{12:│}[2:--------------------------]|
  1920. [5:--------------------------]{12:│}[2:--------------------------]|
  1921. [5:--------------------------]{12:│}[2:--------------------------]|
  1922. [5:--------------------------]{12:│}[2:--------------------------]|
  1923. [5:--------------------------]{12:│}[2:--------------------------]|
  1924. {11:[No Name] [+] }{12:[No Name] [+] }|
  1925. [3:-----------------------------------------------------]|
  1926. ## grid 2
  1927. some text |
  1928. to be clicked |
  1929. {1:~ }|
  1930. {1:~ }|
  1931. {1:~ }|
  1932. {1:~ }|
  1933. {1:~ }|
  1934. ## grid 3
  1935. |
  1936. ## grid 4
  1937. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
  1938. {1:~ }|
  1939. ## grid 5
  1940. some text |
  1941. to be ^clicked |
  1942. {1:~ }|
  1943. {1:~ }|
  1944. {1:~ }|
  1945. {1:~ }|
  1946. {1:~ }|
  1947. ]]}
  1948. meths.input_mouse('left', 'press', '', 1,8, 26)
  1949. poke_eventloop()
  1950. meths.input_mouse('left', 'drag', '', 1, 6, 30)
  1951. screen:expect{grid=[[
  1952. ## grid 1
  1953. [4:-----------------------------------------------------]|
  1954. [4:-----------------------------------------------------]|
  1955. [4:-----------------------------------------------------]|
  1956. [4:-----------------------------------------------------]|
  1957. {12:[No Name] [+] }|
  1958. [5:------------------------------]{12:│}[2:----------------------]|
  1959. [5:------------------------------]{12:│}[2:----------------------]|
  1960. [5:------------------------------]{12:│}[2:----------------------]|
  1961. [5:------------------------------]{12:│}[2:----------------------]|
  1962. [5:------------------------------]{12:│}[2:----------------------]|
  1963. [5:------------------------------]{12:│}[2:----------------------]|
  1964. [5:------------------------------]{12:│}[2:----------------------]|
  1965. {11:[No Name] [+] }{12:[No Name] [+] }|
  1966. [3:-----------------------------------------------------]|
  1967. ## grid 2
  1968. some text |
  1969. to be clicked |
  1970. {1:~ }|
  1971. {1:~ }|
  1972. {1:~ }|
  1973. {1:~ }|
  1974. {1:~ }|
  1975. ## grid 3
  1976. |
  1977. ## grid 4
  1978. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
  1979. {1:~ }|
  1980. ## grid 5
  1981. some text |
  1982. to be ^clicked |
  1983. {1:~ }|
  1984. {1:~ }|
  1985. {1:~ }|
  1986. {1:~ }|
  1987. {1:~ }|
  1988. ]]}
  1989. end)
  1990. it('has viewport information', function()
  1991. screen:try_resize(48, 8)
  1992. screen:expect{grid=[[
  1993. ## grid 1
  1994. [2:------------------------------------------------]|
  1995. [2:------------------------------------------------]|
  1996. [2:------------------------------------------------]|
  1997. [2:------------------------------------------------]|
  1998. [2:------------------------------------------------]|
  1999. [2:------------------------------------------------]|
  2000. {11:[No Name] }|
  2001. [3:------------------------------------------------]|
  2002. ## grid 2
  2003. ^ |
  2004. {1:~ }|
  2005. {1:~ }|
  2006. {1:~ }|
  2007. {1:~ }|
  2008. {1:~ }|
  2009. ## grid 3
  2010. |
  2011. ]], win_viewport={
  2012. [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
  2013. }}
  2014. insert([[
  2015. Lorem ipsum dolor sit amet, consectetur
  2016. adipisicing elit, sed do eiusmod tempor
  2017. incididunt ut labore et dolore magna aliqua.
  2018. Ut enim ad minim veniam, quis nostrud
  2019. exercitation ullamco laboris nisi ut aliquip ex
  2020. ea commodo consequat. Duis aute irure dolor in
  2021. reprehenderit in voluptate velit esse cillum
  2022. dolore eu fugiat nulla pariatur. Excepteur sint
  2023. occaecat cupidatat non proident, sunt in culpa
  2024. qui officia deserunt mollit anim id est
  2025. laborum.]])
  2026. screen:expect{grid=[[
  2027. ## grid 1
  2028. [2:------------------------------------------------]|
  2029. [2:------------------------------------------------]|
  2030. [2:------------------------------------------------]|
  2031. [2:------------------------------------------------]|
  2032. [2:------------------------------------------------]|
  2033. [2:------------------------------------------------]|
  2034. {11:[No Name] [+] }|
  2035. [3:------------------------------------------------]|
  2036. ## grid 2
  2037. ea commodo consequat. Duis aute irure dolor in |
  2038. reprehenderit in voluptate velit esse cillum |
  2039. dolore eu fugiat nulla pariatur. Excepteur sint |
  2040. occaecat cupidatat non proident, sunt in culpa |
  2041. qui officia deserunt mollit anim id est |
  2042. laborum^. |
  2043. ## grid 3
  2044. |
  2045. ]], win_viewport={
  2046. [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
  2047. }}
  2048. feed('<c-u>')
  2049. screen:expect{grid=[[
  2050. ## grid 1
  2051. [2:------------------------------------------------]|
  2052. [2:------------------------------------------------]|
  2053. [2:------------------------------------------------]|
  2054. [2:------------------------------------------------]|
  2055. [2:------------------------------------------------]|
  2056. [2:------------------------------------------------]|
  2057. {11:[No Name] [+] }|
  2058. [3:------------------------------------------------]|
  2059. ## grid 2
  2060. incididunt ut labore et dolore magna aliqua. |
  2061. Ut enim ad minim veniam, quis nostrud |
  2062. exercitation ullamco laboris nisi ut aliquip ex |
  2063. ea commodo consequat. Duis aute irure dolor in |
  2064. reprehenderit in voluptate velit esse cillum |
  2065. ^dolore eu fugiat nulla pariatur. Excepteur sint |
  2066. ## grid 3
  2067. |
  2068. ]], win_viewport={
  2069. [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0},
  2070. }}
  2071. command("split")
  2072. screen:expect{grid=[[
  2073. ## grid 1
  2074. [4:------------------------------------------------]|
  2075. [4:------------------------------------------------]|
  2076. [4:------------------------------------------------]|
  2077. {11:[No Name] [+] }|
  2078. [2:------------------------------------------------]|
  2079. [2:------------------------------------------------]|
  2080. {12:[No Name] [+] }|
  2081. [3:------------------------------------------------]|
  2082. ## grid 2
  2083. reprehenderit in voluptate velit esse cillum |
  2084. dolore eu fugiat nulla pariatur. Excepteur sint |
  2085. ## grid 3
  2086. |
  2087. ## grid 4
  2088. ea commodo consequat. Duis aute irure dolor in |
  2089. reprehenderit in voluptate velit esse cillum |
  2090. ^dolore eu fugiat nulla pariatur. Excepteur sint |
  2091. ]], win_viewport={
  2092. [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
  2093. [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0},
  2094. }}
  2095. feed("b")
  2096. screen:expect{grid=[[
  2097. ## grid 1
  2098. [4:------------------------------------------------]|
  2099. [4:------------------------------------------------]|
  2100. [4:------------------------------------------------]|
  2101. {11:[No Name] [+] }|
  2102. [2:------------------------------------------------]|
  2103. [2:------------------------------------------------]|
  2104. {12:[No Name] [+] }|
  2105. [3:------------------------------------------------]|
  2106. ## grid 2
  2107. reprehenderit in voluptate velit esse cillum |
  2108. dolore eu fugiat nulla pariatur. Excepteur sint |
  2109. ## grid 3
  2110. |
  2111. ## grid 4
  2112. ea commodo consequat. Duis aute irure dolor in |
  2113. reprehenderit in voluptate velit esse ^cillum |
  2114. dolore eu fugiat nulla pariatur. Excepteur sint |
  2115. ]], win_viewport={
  2116. [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
  2117. [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38},
  2118. }}
  2119. feed("2k")
  2120. screen:expect{grid=[[
  2121. ## grid 1
  2122. [4:------------------------------------------------]|
  2123. [4:------------------------------------------------]|
  2124. [4:------------------------------------------------]|
  2125. {11:[No Name] [+] }|
  2126. [2:------------------------------------------------]|
  2127. [2:------------------------------------------------]|
  2128. {12:[No Name] [+] }|
  2129. [3:------------------------------------------------]|
  2130. ## grid 2
  2131. reprehenderit in voluptate velit esse cillum |
  2132. dolore eu fugiat nulla pariatur. Excepteur sint |
  2133. ## grid 3
  2134. |
  2135. ## grid 4
  2136. exercitation ullamco laboris nisi ut a^liquip ex |
  2137. ea commodo consequat. Duis aute irure dolor in |
  2138. reprehenderit in voluptate velit esse cillum |
  2139. ]], win_viewport={
  2140. [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
  2141. [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
  2142. }}
  2143. -- handles non-current window
  2144. meths.win_set_cursor(1000, {1, 10})
  2145. screen:expect{grid=[[
  2146. ## grid 1
  2147. [4:------------------------------------------------]|
  2148. [4:------------------------------------------------]|
  2149. [4:------------------------------------------------]|
  2150. {11:[No Name] [+] }|
  2151. [2:------------------------------------------------]|
  2152. [2:------------------------------------------------]|
  2153. {12:[No Name] [+] }|
  2154. [3:------------------------------------------------]|
  2155. ## grid 2
  2156. Lorem ipsum dolor sit amet, consectetur |
  2157. adipisicing elit, sed do eiusmod tempor |
  2158. ## grid 3
  2159. |
  2160. ## grid 4
  2161. exercitation ullamco laboris nisi ut a^liquip ex |
  2162. ea commodo consequat. Duis aute irure dolor in |
  2163. reprehenderit in voluptate velit esse cillum |
  2164. ]], win_viewport={
  2165. [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10},
  2166. [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
  2167. }}
  2168. end)
  2169. end)