messages_spec.lua 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. local n = require('test.functional.testnvim')()
  2. local Screen = require('test.functional.ui.screen')
  3. local clear = n.clear
  4. local command = n.command
  5. local exec = n.exec
  6. local feed = n.feed
  7. local api = n.api
  8. local nvim_dir = n.nvim_dir
  9. local assert_alive = n.assert_alive
  10. before_each(clear)
  11. describe('messages', function()
  12. local screen
  13. -- oldtest: Test_warning_scroll()
  14. it('a warning causes scrolling if and only if it has a stacktrace', function()
  15. screen = Screen.new(75, 6)
  16. -- When the warning comes from a script, messages are scrolled so that the
  17. -- stacktrace is visible.
  18. -- It is a bit hard to assert the screen when sourcing a script, so skip this part.
  19. -- When the warning does not come from a script, messages are not scrolled.
  20. command('enew')
  21. command('set readonly')
  22. feed('u')
  23. screen:expect({
  24. grid = [[
  25. |
  26. {1:~ }|*4
  27. {19:W10: Warning: Changing a readonly file}^ |
  28. ]],
  29. timeout = 500,
  30. })
  31. screen:expect([[
  32. ^ |
  33. {1:~ }|*4
  34. Already at oldest change |
  35. ]])
  36. end)
  37. -- oldtest: Test_message_not_cleared_after_mode()
  38. it('clearing mode does not remove message', function()
  39. screen = Screen.new(60, 10)
  40. exec([[
  41. nmap <silent> gx :call DebugSilent('normal')<CR>
  42. vmap <silent> gx :call DebugSilent('visual')<CR>
  43. function DebugSilent(arg)
  44. echomsg "from DebugSilent" a:arg
  45. endfunction
  46. set showmode
  47. set cmdheight=1
  48. call setline(1, ['one', 'NoSuchFile', 'three'])
  49. ]])
  50. feed('gx')
  51. screen:expect([[
  52. ^one |
  53. NoSuchFile |
  54. three |
  55. {1:~ }|*6
  56. from DebugSilent normal |
  57. ]])
  58. -- removing the mode message used to also clear the intended message
  59. feed('vEgx')
  60. screen:expect([[
  61. ^one |
  62. NoSuchFile |
  63. three |
  64. {1:~ }|*6
  65. from DebugSilent visual |
  66. ]])
  67. -- removing the mode message used to also clear the error message
  68. command('set cmdheight=2')
  69. feed('2GvEgf')
  70. screen:expect([[
  71. one |
  72. NoSuchFil^e |
  73. three |
  74. {1:~ }|*5
  75. |
  76. {9:E447: Can't find file "NoSuchFile" in path} |
  77. ]])
  78. end)
  79. -- oldtest: Test_mode_cleared_after_silent_message()
  80. it('mode is cleared properly after silent message', function()
  81. screen = Screen.new(60, 10)
  82. exec([[
  83. edit XsilentMessageMode.txt
  84. call setline(1, 'foobar')
  85. autocmd TextChanged * silent update
  86. ]])
  87. finally(function()
  88. os.remove('XsilentMessageMode.txt')
  89. end)
  90. feed('v')
  91. screen:expect([[
  92. ^foobar |
  93. {1:~ }|*8
  94. {5:-- VISUAL --} |
  95. ]])
  96. feed('d')
  97. screen:expect([[
  98. ^oobar |
  99. {1:~ }|*8
  100. |
  101. ]])
  102. end)
  103. describe('more prompt', function()
  104. before_each(function()
  105. command('set more')
  106. end)
  107. -- oldtest: Test_message_more()
  108. it('works', function()
  109. screen = Screen.new(75, 6)
  110. command('call setline(1, range(1, 100))')
  111. feed(':%pfoo<C-H><C-H><C-H>#')
  112. screen:expect([[
  113. 1 |
  114. 2 |
  115. 3 |
  116. 4 |
  117. 5 |
  118. :%p#^ |
  119. ]])
  120. feed('\n')
  121. screen:expect([[
  122. {8: 1 }1 |
  123. {8: 2 }2 |
  124. {8: 3 }3 |
  125. {8: 4 }4 |
  126. {8: 5 }5 |
  127. {6:-- More --}^ |
  128. ]])
  129. feed('?')
  130. screen:expect([[
  131. {8: 1 }1 |
  132. {8: 2 }2 |
  133. {8: 3 }3 |
  134. {8: 4 }4 |
  135. {8: 5 }5 |
  136. {6:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ |
  137. ]])
  138. -- Down a line with j, <CR>, <NL> or <Down>.
  139. feed('j')
  140. screen:expect([[
  141. {8: 2 }2 |
  142. {8: 3 }3 |
  143. {8: 4 }4 |
  144. {8: 5 }5 |
  145. {8: 6 }6 |
  146. {6:-- More --}^ |
  147. ]])
  148. feed('<NL>')
  149. screen:expect([[
  150. {8: 3 }3 |
  151. {8: 4 }4 |
  152. {8: 5 }5 |
  153. {8: 6 }6 |
  154. {8: 7 }7 |
  155. {6:-- More --}^ |
  156. ]])
  157. feed('<CR>')
  158. screen:expect([[
  159. {8: 4 }4 |
  160. {8: 5 }5 |
  161. {8: 6 }6 |
  162. {8: 7 }7 |
  163. {8: 8 }8 |
  164. {6:-- More --}^ |
  165. ]])
  166. feed('<Down>')
  167. screen:expect([[
  168. {8: 5 }5 |
  169. {8: 6 }6 |
  170. {8: 7 }7 |
  171. {8: 8 }8 |
  172. {8: 9 }9 |
  173. {6:-- More --}^ |
  174. ]])
  175. -- Down a screen with <Space>, f, or <PageDown>.
  176. feed('f')
  177. screen:expect([[
  178. {8: 10 }10 |
  179. {8: 11 }11 |
  180. {8: 12 }12 |
  181. {8: 13 }13 |
  182. {8: 14 }14 |
  183. {6:-- More --}^ |
  184. ]])
  185. feed('<Space>')
  186. screen:expect([[
  187. {8: 15 }15 |
  188. {8: 16 }16 |
  189. {8: 17 }17 |
  190. {8: 18 }18 |
  191. {8: 19 }19 |
  192. {6:-- More --}^ |
  193. ]])
  194. feed('<PageDown>')
  195. screen:expect([[
  196. {8: 20 }20 |
  197. {8: 21 }21 |
  198. {8: 22 }22 |
  199. {8: 23 }23 |
  200. {8: 24 }24 |
  201. {6:-- More --}^ |
  202. ]])
  203. -- Down a page (half a screen) with d.
  204. feed('d')
  205. screen:expect([[
  206. {8: 23 }23 |
  207. {8: 24 }24 |
  208. {8: 25 }25 |
  209. {8: 26 }26 |
  210. {8: 27 }27 |
  211. {6:-- More --}^ |
  212. ]])
  213. -- Down all the way with 'G'.
  214. feed('G')
  215. screen:expect([[
  216. {8: 96 }96 |
  217. {8: 97 }97 |
  218. {8: 98 }98 |
  219. {8: 99 }99 |
  220. {8:100 }100 |
  221. {6:Press ENTER or type command to continue}^ |
  222. ]])
  223. -- Up a line k, <BS> or <Up>.
  224. feed('k')
  225. screen:expect([[
  226. {8: 95 }95 |
  227. {8: 96 }96 |
  228. {8: 97 }97 |
  229. {8: 98 }98 |
  230. {8: 99 }99 |
  231. {6:-- More --}^ |
  232. ]])
  233. feed('<BS>')
  234. screen:expect([[
  235. {8: 94 }94 |
  236. {8: 95 }95 |
  237. {8: 96 }96 |
  238. {8: 97 }97 |
  239. {8: 98 }98 |
  240. {6:-- More --}^ |
  241. ]])
  242. feed('<Up>')
  243. screen:expect([[
  244. {8: 93 }93 |
  245. {8: 94 }94 |
  246. {8: 95 }95 |
  247. {8: 96 }96 |
  248. {8: 97 }97 |
  249. {6:-- More --}^ |
  250. ]])
  251. -- Up a screen with b or <PageUp>.
  252. feed('b')
  253. screen:expect([[
  254. {8: 88 }88 |
  255. {8: 89 }89 |
  256. {8: 90 }90 |
  257. {8: 91 }91 |
  258. {8: 92 }92 |
  259. {6:-- More --}^ |
  260. ]])
  261. feed('<PageUp>')
  262. screen:expect([[
  263. {8: 83 }83 |
  264. {8: 84 }84 |
  265. {8: 85 }85 |
  266. {8: 86 }86 |
  267. {8: 87 }87 |
  268. {6:-- More --}^ |
  269. ]])
  270. -- Up a page (half a screen) with u.
  271. feed('u')
  272. screen:expect([[
  273. {8: 80 }80 |
  274. {8: 81 }81 |
  275. {8: 82 }82 |
  276. {8: 83 }83 |
  277. {8: 84 }84 |
  278. {6:-- More --}^ |
  279. ]])
  280. -- Up all the way with 'g'.
  281. feed('g')
  282. screen:expect([[
  283. :%p# |
  284. {8: 1 }1 |
  285. {8: 2 }2 |
  286. {8: 3 }3 |
  287. {8: 4 }4 |
  288. {6:-- More --}^ |
  289. ]])
  290. -- All the way down. Pressing f should do nothing but pressing
  291. -- space should end the more prompt.
  292. feed('G')
  293. screen:expect([[
  294. {8: 96 }96 |
  295. {8: 97 }97 |
  296. {8: 98 }98 |
  297. {8: 99 }99 |
  298. {8:100 }100 |
  299. {6:Press ENTER or type command to continue}^ |
  300. ]])
  301. feed('f')
  302. screen:expect_unchanged()
  303. feed('<Space>')
  304. screen:expect([[
  305. 96 |
  306. 97 |
  307. 98 |
  308. 99 |
  309. ^100 |
  310. |
  311. ]])
  312. -- Pressing g< shows the previous command output.
  313. feed('g<lt>')
  314. screen:expect([[
  315. {8: 96 }96 |
  316. {8: 97 }97 |
  317. {8: 98 }98 |
  318. {8: 99 }99 |
  319. {8:100 }100 |
  320. {6:Press ENTER or type command to continue}^ |
  321. ]])
  322. -- A command line that doesn't print text is appended to scrollback,
  323. -- even if it invokes a nested command line.
  324. feed([[:<C-R>=':'<CR>:<CR>g<lt>]])
  325. screen:expect([[
  326. {8: 97 }97 |
  327. {8: 98 }98 |
  328. {8: 99 }99 |
  329. {8:100 }100 |
  330. ::: |
  331. {6:Press ENTER or type command to continue}^ |
  332. ]])
  333. feed(':%p#\n')
  334. screen:expect([[
  335. {8: 1 }1 |
  336. {8: 2 }2 |
  337. {8: 3 }3 |
  338. {8: 4 }4 |
  339. {8: 5 }5 |
  340. {6:-- More --}^ |
  341. ]])
  342. -- Stop command output with q, <Esc> or CTRL-C.
  343. feed('q')
  344. screen:expect([[
  345. 96 |
  346. 97 |
  347. 98 |
  348. 99 |
  349. ^100 |
  350. |
  351. ]])
  352. -- Execute a : command from the more prompt
  353. feed(':%p#\n')
  354. screen:expect([[
  355. {8: 1 }1 |
  356. {8: 2 }2 |
  357. {8: 3 }3 |
  358. {8: 4 }4 |
  359. {8: 5 }5 |
  360. {6:-- More --}^ |
  361. ]])
  362. feed(':')
  363. screen:expect([[
  364. {8: 1 }1 |
  365. {8: 2 }2 |
  366. {8: 3 }3 |
  367. {8: 4 }4 |
  368. {8: 5 }5 |
  369. :^ |
  370. ]])
  371. feed("echo 'Hello'\n")
  372. screen:expect([[
  373. {8: 2 }2 |
  374. {8: 3 }3 |
  375. {8: 4 }4 |
  376. {8: 5 }5 |
  377. Hello |
  378. {6:Press ENTER or type command to continue}^ |
  379. ]])
  380. end)
  381. -- oldtest: Test_echo_verbose_system()
  382. it('verbose message before echo command', function()
  383. screen = Screen.new(60, 10)
  384. command('cd ' .. nvim_dir)
  385. api.nvim_set_option_value('shell', './shell-test', {})
  386. api.nvim_set_option_value('shellcmdflag', 'REP 20', {})
  387. api.nvim_set_option_value('shellxquote', '', {}) -- win: avoid extra quotes
  388. -- display a page and go back, results in exactly the same view
  389. feed([[:4 verbose echo system('foo')<CR>]])
  390. screen:expect([[
  391. Executing command: "'./shell-test' 'REP' '20' 'foo'" |
  392. |
  393. 0: foo |
  394. 1: foo |
  395. 2: foo |
  396. 3: foo |
  397. 4: foo |
  398. 5: foo |
  399. 6: foo |
  400. {6:-- More --}^ |
  401. ]])
  402. feed('<Space>')
  403. screen:expect([[
  404. 7: foo |
  405. 8: foo |
  406. 9: foo |
  407. 10: foo |
  408. 11: foo |
  409. 12: foo |
  410. 13: foo |
  411. 14: foo |
  412. 15: foo |
  413. {6:-- More --}^ |
  414. ]])
  415. feed('b')
  416. screen:expect([[
  417. Executing command: "'./shell-test' 'REP' '20' 'foo'" |
  418. |
  419. 0: foo |
  420. 1: foo |
  421. 2: foo |
  422. 3: foo |
  423. 4: foo |
  424. 5: foo |
  425. 6: foo |
  426. {6:-- More --}^ |
  427. ]])
  428. -- do the same with 'cmdheight' set to 2
  429. feed('q')
  430. command('set ch=2')
  431. screen:expect([[
  432. ^ |
  433. {1:~ }|*7
  434. |*2
  435. ]])
  436. feed([[:4 verbose echo system('foo')<CR>]])
  437. screen:expect([[
  438. Executing command: "'./shell-test' 'REP' '20' 'foo'" |
  439. |
  440. 0: foo |
  441. 1: foo |
  442. 2: foo |
  443. 3: foo |
  444. 4: foo |
  445. 5: foo |
  446. 6: foo |
  447. {6:-- More --}^ |
  448. ]])
  449. feed('<Space>')
  450. screen:expect([[
  451. 7: foo |
  452. 8: foo |
  453. 9: foo |
  454. 10: foo |
  455. 11: foo |
  456. 12: foo |
  457. 13: foo |
  458. 14: foo |
  459. 15: foo |
  460. {6:-- More --}^ |
  461. ]])
  462. feed('b')
  463. screen:expect([[
  464. Executing command: "'./shell-test' 'REP' '20' 'foo'" |
  465. |
  466. 0: foo |
  467. 1: foo |
  468. 2: foo |
  469. 3: foo |
  470. 4: foo |
  471. 5: foo |
  472. 6: foo |
  473. {6:-- More --}^ |
  474. ]])
  475. end)
  476. -- oldtest: Test_quit_long_message()
  477. it('with control characters can be quit vim-patch:8.2.1844', function()
  478. screen = Screen.new(40, 10)
  479. feed([[:echom range(9999)->join("\x01")<CR>]])
  480. screen:expect([[
  481. 0{18:^A}1{18:^A}2{18:^A}3{18:^A}4{18:^A}5{18:^A}6{18:^A}7{18:^A}8{18:^A}9{18:^A}10{18:^A}11{18:^A}12|
  482. {18:^A}13{18:^A}14{18:^A}15{18:^A}16{18:^A}17{18:^A}18{18:^A}19{18:^A}20{18:^A}21{18:^A}22|
  483. {18:^A}23{18:^A}24{18:^A}25{18:^A}26{18:^A}27{18:^A}28{18:^A}29{18:^A}30{18:^A}31{18:^A}32|
  484. {18:^A}33{18:^A}34{18:^A}35{18:^A}36{18:^A}37{18:^A}38{18:^A}39{18:^A}40{18:^A}41{18:^A}42|
  485. {18:^A}43{18:^A}44{18:^A}45{18:^A}46{18:^A}47{18:^A}48{18:^A}49{18:^A}50{18:^A}51{18:^A}52|
  486. {18:^A}53{18:^A}54{18:^A}55{18:^A}56{18:^A}57{18:^A}58{18:^A}59{18:^A}60{18:^A}61{18:^A}62|
  487. {18:^A}63{18:^A}64{18:^A}65{18:^A}66{18:^A}67{18:^A}68{18:^A}69{18:^A}70{18:^A}71{18:^A}72|
  488. {18:^A}73{18:^A}74{18:^A}75{18:^A}76{18:^A}77{18:^A}78{18:^A}79{18:^A}80{18:^A}81{18:^A}82|
  489. {18:^A}83{18:^A}84{18:^A}85{18:^A}86{18:^A}87{18:^A}88{18:^A}89{18:^A}90{18:^A}91{18:^A}92|
  490. {6:-- More --}^ |
  491. ]])
  492. feed('q')
  493. screen:expect([[
  494. ^ |
  495. {1:~ }|*8
  496. |
  497. ]])
  498. end)
  499. end)
  500. describe('mode is cleared when', function()
  501. before_each(function()
  502. screen = Screen.new(40, 6)
  503. end)
  504. -- oldtest: Test_mode_message_at_leaving_insert_by_ctrl_c()
  505. it('leaving Insert mode with Ctrl-C vim-patch:8.1.1189', function()
  506. exec([[
  507. func StatusLine() abort
  508. return ""
  509. endfunc
  510. set statusline=%!StatusLine()
  511. set laststatus=2
  512. ]])
  513. feed('i')
  514. screen:expect([[
  515. ^ |
  516. {1:~ }|*3
  517. {3: }|
  518. {5:-- INSERT --} |
  519. ]])
  520. feed('<C-C>')
  521. screen:expect([[
  522. ^ |
  523. {1:~ }|*3
  524. {3: }|
  525. |
  526. ]])
  527. end)
  528. -- oldtest: Test_mode_message_at_leaving_insert_with_esc_mapped()
  529. it('leaving Insert mode with ESC in the middle of a mapping vim-patch:8.1.1192', function()
  530. exec([[
  531. set laststatus=2
  532. inoremap <Esc> <Esc>00
  533. ]])
  534. feed('i')
  535. screen:expect([[
  536. ^ |
  537. {1:~ }|*3
  538. {3:[No Name] }|
  539. {5:-- INSERT --} |
  540. ]])
  541. feed('<Esc>')
  542. screen:expect([[
  543. ^ |
  544. {1:~ }|*3
  545. {3:[No Name] }|
  546. |
  547. ]])
  548. end)
  549. -- oldtest: Test_mode_updated_after_ctrl_c()
  550. it('pressing Ctrl-C in i_CTRL-O', function()
  551. feed('i<C-O>')
  552. screen:expect([[
  553. ^ |
  554. {1:~ }|*4
  555. {5:-- (insert) --} |
  556. ]])
  557. feed('<C-C>')
  558. screen:expect([[
  559. ^ |
  560. {1:~ }|*4
  561. |
  562. ]])
  563. end)
  564. end)
  565. -- oldtest: Test_ask_yesno()
  566. it('y/n prompt works', function()
  567. screen = Screen.new(75, 6)
  568. command('set noincsearch nohlsearch inccommand=')
  569. command('call setline(1, range(1, 2))')
  570. feed(':2,1s/^/n/\n')
  571. screen:expect([[
  572. 1 |
  573. 2 |
  574. {1:~ }|*3
  575. {6:Backwards range given, OK to swap (y/n)?}^ |
  576. ]])
  577. feed('n')
  578. screen:expect([[
  579. ^1 |
  580. 2 |
  581. {1:~ }|*3
  582. {6:Backwards range given, OK to swap (y/n)?}n |
  583. ]])
  584. feed(':2,1s/^/Esc/\n')
  585. screen:expect([[
  586. 1 |
  587. 2 |
  588. {1:~ }|*3
  589. {6:Backwards range given, OK to swap (y/n)?}^ |
  590. ]])
  591. feed('<Esc>')
  592. screen:expect([[
  593. ^1 |
  594. 2 |
  595. {1:~ }|*3
  596. {6:Backwards range given, OK to swap (y/n)?}n |
  597. ]])
  598. feed(':2,1s/^/y/\n')
  599. screen:expect([[
  600. 1 |
  601. 2 |
  602. {1:~ }|*3
  603. {6:Backwards range given, OK to swap (y/n)?}^ |
  604. ]])
  605. feed('y')
  606. screen:expect([[
  607. y1 |
  608. ^y2 |
  609. {1:~ }|*3
  610. {6:Backwards range given, OK to swap (y/n)?}y |
  611. ]])
  612. end)
  613. -- oldtest: Test_fileinfo_tabpage_cmdheight()
  614. it("fileinfo works when 'cmdheight' has just decreased", function()
  615. screen = Screen.new(40, 6)
  616. exec([[
  617. set shortmess-=o
  618. set shortmess-=O
  619. set shortmess-=F
  620. tabnew
  621. set cmdheight=2
  622. ]])
  623. screen:expect([[
  624. {24: [No Name] }{5: [No Name] }{2: }{24:X}|
  625. ^ |
  626. {1:~ }|*2
  627. |*2
  628. ]])
  629. feed(':tabprev | edit Xfileinfo.txt<CR>')
  630. screen:expect([[
  631. {5: Xfileinfo.txt }{24: [No Name] }{2: }{24:X}|
  632. ^ |
  633. {1:~ }|*3
  634. "Xfileinfo.txt" [New] |
  635. ]])
  636. assert_alive()
  637. end)
  638. -- oldtest: Test_fileinfo_after_echo()
  639. it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
  640. screen = Screen.new(40, 6)
  641. exec([[
  642. set shortmess-=F
  643. file a.txt
  644. hide edit b.txt
  645. call setline(1, "hi")
  646. setlocal modified
  647. hide buffer a.txt
  648. autocmd CursorHold * buf b.txt | w | echo "'b' written"
  649. ]])
  650. command('set updatetime=50')
  651. feed('0$')
  652. screen:expect([[
  653. ^hi |
  654. {1:~ }|*4
  655. 'b' written |
  656. ]])
  657. os.remove('b.txt')
  658. end)
  659. -- oldtest: Test_messagesopt_wait()
  660. it('&messagesopt "wait"', function()
  661. screen = Screen.new(45, 6)
  662. command('set cmdheight=1')
  663. -- Check hit-enter prompt
  664. command('set messagesopt=hit-enter,history:500')
  665. feed(":echo 'foo' | echo 'bar' | echo 'baz'\n")
  666. screen:expect([[
  667. |
  668. {3: }|
  669. foo |
  670. bar |
  671. baz |
  672. {6:Press ENTER or type command to continue}^ |
  673. ]])
  674. feed('<CR>')
  675. -- Check no hit-enter prompt when "wait:" is set
  676. command('set messagesopt=wait:500,history:500')
  677. feed(":echo 'foo' | echo 'bar' | echo 'baz'\n")
  678. screen:expect({
  679. grid = [[
  680. |
  681. {1:~ }|
  682. {3: }|
  683. foo |
  684. bar |
  685. baz |
  686. ]],
  687. timeout = 500,
  688. })
  689. screen:expect([[
  690. ^ |
  691. {1:~ }|*4
  692. |
  693. ]])
  694. end)
  695. end)