cmdline_spec.lua 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local clear, feed = helpers.clear, helpers.feed
  4. local source = helpers.source
  5. local command = helpers.command
  6. local assert_alive = helpers.assert_alive
  7. local function new_screen(opt)
  8. local screen = Screen.new(25, 5)
  9. screen:attach(opt)
  10. screen:set_default_attr_ids({
  11. [1] = {bold = true, foreground = Screen.colors.Blue1},
  12. [2] = {reverse = true},
  13. [3] = {bold = true, reverse = true},
  14. [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  15. [5] = {bold = true, foreground = Screen.colors.SeaGreen4},
  16. })
  17. return screen
  18. end
  19. local function test_cmdline(linegrid)
  20. local screen
  21. before_each(function()
  22. clear()
  23. screen = new_screen({rgb=true, ext_cmdline=true, ext_linegrid=linegrid})
  24. end)
  25. it('works', function()
  26. feed(':')
  27. screen:expect{grid=[[
  28. ^ |
  29. {1:~ }|
  30. {1:~ }|
  31. {1:~ }|
  32. |
  33. ]], cmdline={{
  34. firstc = ":",
  35. content = {{""}},
  36. pos = 0,
  37. }}}
  38. feed('sign')
  39. screen:expect{grid=[[
  40. ^ |
  41. {1:~ }|
  42. {1:~ }|
  43. {1:~ }|
  44. |
  45. ]], cmdline={{
  46. firstc = ":",
  47. content = {{"sign"}},
  48. pos = 4,
  49. }}}
  50. feed('<Left>')
  51. screen:expect{grid=[[
  52. ^ |
  53. {1:~ }|
  54. {1:~ }|
  55. {1:~ }|
  56. |
  57. ]], cmdline={{
  58. firstc = ":",
  59. content = {{"sign"}},
  60. pos = 3,
  61. }}}
  62. feed('<bs>')
  63. screen:expect{grid=[[
  64. ^ |
  65. {1:~ }|
  66. {1:~ }|
  67. {1:~ }|
  68. |
  69. ]], cmdline={{
  70. firstc = ":",
  71. content = {{"sin"}},
  72. pos = 2,
  73. }}}
  74. feed('<Esc>')
  75. screen:expect{grid=[[
  76. ^ |
  77. {1:~ }|
  78. {1:~ }|
  79. {1:~ }|
  80. |
  81. ]]}
  82. end)
  83. describe("redraws statusline on entering", function()
  84. before_each(function()
  85. command('set laststatus=2')
  86. command('set statusline=%{mode()}')
  87. end)
  88. it('from normal mode', function()
  89. screen:expect{grid=[[
  90. ^ |
  91. {1:~ }|
  92. {1:~ }|
  93. {3:n }|
  94. |
  95. ]]}
  96. feed(':')
  97. screen:expect{grid=[[
  98. ^ |
  99. {1:~ }|
  100. {1:~ }|
  101. {3:c }|
  102. |
  103. ]], cmdline={{
  104. firstc = ":",
  105. content = {{""}},
  106. pos = 0,
  107. }}}
  108. end)
  109. it('from normal mode when : is mapped', function()
  110. command('nnoremap ; :')
  111. screen:expect{grid=[[
  112. ^ |
  113. {1:~ }|
  114. {1:~ }|
  115. {3:n }|
  116. |
  117. ]]}
  118. feed(';')
  119. screen:expect{grid=[[
  120. ^ |
  121. {1:~ }|
  122. {1:~ }|
  123. {3:c }|
  124. |
  125. ]], cmdline={{
  126. firstc = ":",
  127. content = {{""}},
  128. pos = 0,
  129. }}}
  130. end)
  131. it('but not with scrolled messages', function()
  132. screen:try_resize(35,10)
  133. feed(':echoerr doesnotexist<cr>')
  134. screen:expect{grid=[[
  135. |
  136. {1:~ }|
  137. {1:~ }|
  138. {1:~ }|
  139. {1:~ }|
  140. {3: }|
  141. {4:E121: Undefined variable: doesnotex}|
  142. {4:ist} |
  143. {5:Press ENTER or type command to cont}|
  144. {5:inue}^ |
  145. ]]}
  146. feed(':echoerr doesnotexist<cr>')
  147. screen:expect{grid=[[
  148. |
  149. {1:~ }|
  150. {3: }|
  151. {4:E121: Undefined variable: doesnotex}|
  152. {4:ist} |
  153. {5:Press ENTER or type command to cont}|
  154. {4:E121: Undefined variable: doesnotex}|
  155. {4:ist} |
  156. {5:Press ENTER or type command to cont}|
  157. {5:inue}^ |
  158. ]]}
  159. feed(':echoerr doesnotexist<cr>')
  160. screen:expect{grid=[[
  161. {4:E121: Undefined variable: doesnotex}|
  162. {4:ist} |
  163. {5:Press ENTER or type command to cont}|
  164. {4:E121: Undefined variable: doesnotex}|
  165. {4:ist} |
  166. {5:Press ENTER or type command to cont}|
  167. {4:E121: Undefined variable: doesnotex}|
  168. {4:ist} |
  169. {5:Press ENTER or type command to cont}|
  170. {5:inue}^ |
  171. ]]}
  172. feed('<cr>')
  173. screen:expect{grid=[[
  174. ^ |
  175. {1:~ }|
  176. {1:~ }|
  177. {1:~ }|
  178. {1:~ }|
  179. {1:~ }|
  180. {1:~ }|
  181. {1:~ }|
  182. {3:n }|
  183. |
  184. ]]}
  185. end)
  186. end)
  187. it("works with input()", function()
  188. feed(':call input("input", "default")<cr>')
  189. screen:expect{grid=[[
  190. ^ |
  191. {1:~ }|
  192. {1:~ }|
  193. {1:~ }|
  194. |
  195. ]], cmdline={{
  196. prompt = "input",
  197. content = {{"default"}},
  198. pos = 7,
  199. }}}
  200. feed('<cr>')
  201. screen:expect{grid=[[
  202. ^ |
  203. {1:~ }|
  204. {1:~ }|
  205. {1:~ }|
  206. |
  207. ]]}
  208. end)
  209. it("works with special chars and nested cmdline", function()
  210. feed(':xx<c-r>')
  211. screen:expect{grid=[[
  212. ^ |
  213. {1:~ }|
  214. {1:~ }|
  215. {1:~ }|
  216. |
  217. ]], cmdline={{
  218. firstc = ":",
  219. content = {{"xx"}},
  220. pos = 2,
  221. special = {'"', true},
  222. }}}
  223. feed('=')
  224. screen:expect{grid=[[
  225. ^ |
  226. {1:~ }|
  227. {1:~ }|
  228. {1:~ }|
  229. |
  230. ]], cmdline={{
  231. firstc = ":",
  232. content = {{"xx"}},
  233. pos = 2,
  234. special = {'"', true},
  235. }, {
  236. firstc = "=",
  237. content = {{""}},
  238. pos = 0,
  239. }}}
  240. feed('1+2')
  241. local expectation = {{
  242. firstc = ":",
  243. content = {{"xx"}},
  244. pos = 2,
  245. special = {'"', true},
  246. }, {
  247. firstc = "=",
  248. content = {{"1"}, {"+"}, {"2"}},
  249. pos = 3,
  250. }}
  251. screen:expect{grid=[[
  252. ^ |
  253. {1:~ }|
  254. {1:~ }|
  255. {1:~ }|
  256. |
  257. ]], cmdline=expectation}
  258. -- erase information, so we check if it is retransmitted
  259. command("mode")
  260. screen:expect{grid=[[
  261. ^ |
  262. {1:~ }|
  263. {1:~ }|
  264. {1:~ }|
  265. |
  266. ]], cmdline=expectation, reset=true}
  267. feed('<cr>')
  268. screen:expect{grid=[[
  269. ^ |
  270. {1:~ }|
  271. {1:~ }|
  272. {1:~ }|
  273. |
  274. ]], cmdline={{
  275. firstc = ":",
  276. content = {{"xx3"}},
  277. pos = 3,
  278. }}}
  279. feed('<esc>')
  280. screen:expect{grid=[[
  281. ^ |
  282. {1:~ }|
  283. {1:~ }|
  284. {1:~ }|
  285. |
  286. ]]}
  287. end)
  288. it("works with function definitions", function()
  289. feed(':function Foo()<cr>')
  290. screen:expect{grid=[[
  291. ^ |
  292. {1:~ }|
  293. {1:~ }|
  294. {1:~ }|
  295. |
  296. ]], cmdline={{
  297. indent = 2,
  298. firstc = ":",
  299. content = {{""}},
  300. pos = 0,
  301. }}, cmdline_block = {
  302. {{'function Foo()'}},
  303. }}
  304. feed('line1<cr>')
  305. screen:expect{grid=[[
  306. ^ |
  307. {1:~ }|
  308. {1:~ }|
  309. {1:~ }|
  310. |
  311. ]], cmdline={{
  312. indent = 2,
  313. firstc = ":",
  314. content = {{""}},
  315. pos = 0,
  316. }}, cmdline_block = {
  317. {{'function Foo()'}},
  318. {{' line1'}},
  319. }}
  320. command("mode")
  321. screen:expect{grid=[[
  322. ^ |
  323. {1:~ }|
  324. {1:~ }|
  325. {1:~ }|
  326. |
  327. ]], cmdline={{
  328. indent = 2,
  329. firstc = ":",
  330. content = {{""}},
  331. pos = 0,
  332. }}, cmdline_block = {
  333. {{'function Foo()'}},
  334. {{' line1'}},
  335. }, reset=true}
  336. feed('endfunction<cr>')
  337. screen:expect{grid=[[
  338. ^ |
  339. {1:~ }|
  340. {1:~ }|
  341. {1:~ }|
  342. |
  343. ]]}
  344. -- Try once more, to check buffer is reinitialized. #8007
  345. feed(':function Bar()<cr>')
  346. screen:expect{grid=[[
  347. ^ |
  348. {1:~ }|
  349. {1:~ }|
  350. {1:~ }|
  351. |
  352. ]], cmdline={{
  353. indent = 2,
  354. firstc = ":",
  355. content = {{""}},
  356. pos = 0,
  357. }}, cmdline_block = {
  358. {{'function Bar()'}},
  359. }}
  360. feed('endfunction<cr>')
  361. screen:expect{grid=[[
  362. ^ |
  363. {1:~ }|
  364. {1:~ }|
  365. {1:~ }|
  366. |
  367. ]]}
  368. end)
  369. it("works with cmdline window", function()
  370. feed(':make')
  371. screen:expect{grid=[[
  372. ^ |
  373. {1:~ }|
  374. {1:~ }|
  375. {1:~ }|
  376. |
  377. ]], cmdline={{
  378. firstc = ":",
  379. content = {{"make"}},
  380. pos = 4,
  381. }}}
  382. feed('<c-f>')
  383. screen:expect{grid=[[
  384. |
  385. {2:[No Name] }|
  386. {1::}make^ |
  387. {3:[Command Line] }|
  388. |
  389. ]]}
  390. -- nested cmdline
  391. feed(':yank')
  392. screen:expect{grid=[[
  393. |
  394. {2:[No Name] }|
  395. {1::}make^ |
  396. {3:[Command Line] }|
  397. |
  398. ]], cmdline={nil, {
  399. firstc = ":",
  400. content = {{"yank"}},
  401. pos = 4,
  402. }}}
  403. command("mode")
  404. screen:expect{grid=[[
  405. |
  406. {2:[No Name] }|
  407. {1::}make^ |
  408. {3:[Command Line] }|
  409. |
  410. ]], cmdline={nil, {
  411. firstc = ":",
  412. content = {{"yank"}},
  413. pos = 4,
  414. }}, reset=true}
  415. feed("<c-c>")
  416. screen:expect{grid=[[
  417. |
  418. {2:[No Name] }|
  419. {1::}make^ |
  420. {3:[Command Line] }|
  421. |
  422. ]]}
  423. feed("<c-c>")
  424. screen:expect{grid=[[
  425. ^ |
  426. {2:[No Name] }|
  427. {1::}make |
  428. {3:[Command Line] }|
  429. |
  430. ]], cmdline={{
  431. firstc = ":",
  432. content = {{"make"}},
  433. pos = 4,
  434. }}}
  435. command("redraw!")
  436. screen:expect{grid=[[
  437. ^ |
  438. {1:~ }|
  439. {1:~ }|
  440. {1:~ }|
  441. |
  442. ]], cmdline={{
  443. firstc = ":",
  444. content = {{"make"}},
  445. pos = 4,
  446. }}}
  447. end)
  448. it('works with inputsecret()', function()
  449. feed(":call inputsecret('secret:')<cr>abc123")
  450. screen:expect{grid=[[
  451. ^ |
  452. {1:~ }|
  453. {1:~ }|
  454. {1:~ }|
  455. |
  456. ]], cmdline={{
  457. prompt = "secret:",
  458. content = {{"******"}},
  459. pos = 6,
  460. }}}
  461. end)
  462. it('works with highlighted cmdline', function()
  463. source([[
  464. highlight RBP1 guibg=Red
  465. highlight RBP2 guibg=Yellow
  466. highlight RBP3 guibg=Green
  467. highlight RBP4 guibg=Blue
  468. let g:NUM_LVLS = 4
  469. function RainBowParens(cmdline)
  470. let ret = []
  471. let i = 0
  472. let lvl = 0
  473. while i < len(a:cmdline)
  474. if a:cmdline[i] is# '('
  475. call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
  476. let lvl += 1
  477. elseif a:cmdline[i] is# ')'
  478. let lvl -= 1
  479. call add(ret, [i, i + 1, 'RBP' . ((lvl % g:NUM_LVLS) + 1)])
  480. endif
  481. let i += 1
  482. endwhile
  483. return ret
  484. endfunction
  485. map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
  486. "map <f5> :let x = input({'prompt':'>'})<cr>
  487. ]])
  488. screen:set_default_attr_ids({
  489. RBP1={background = Screen.colors.Red},
  490. RBP2={background = Screen.colors.Yellow},
  491. EOB={bold = true, foreground = Screen.colors.Blue1},
  492. })
  493. feed('<f5>(a(b)a)')
  494. screen:expect{grid=[[
  495. ^ |
  496. {EOB:~ }|
  497. {EOB:~ }|
  498. {EOB:~ }|
  499. |
  500. ]], cmdline={{
  501. prompt = '>',
  502. content = {{'(', 'RBP1'}, {'a'}, {'(', 'RBP2'}, {'b'},
  503. { ')', 'RBP2'}, {'a'}, {')', 'RBP1'}},
  504. pos = 7,
  505. }}}
  506. end)
  507. it('works together with ext_wildmenu', function()
  508. local expected = {
  509. 'define',
  510. 'jump',
  511. 'list',
  512. 'place',
  513. 'undefine',
  514. 'unplace',
  515. }
  516. command('set wildmode=full')
  517. command('set wildmenu')
  518. screen:set_option('ext_wildmenu', true)
  519. feed(':sign <tab>')
  520. screen:expect{grid=[[
  521. ^ |
  522. {1:~ }|
  523. {1:~ }|
  524. {1:~ }|
  525. |
  526. ]], cmdline={{
  527. firstc = ":",
  528. content = {{"sign define"}},
  529. pos = 11,
  530. }}, wildmenu_items=expected, wildmenu_pos=0}
  531. feed('<tab>')
  532. screen:expect{grid=[[
  533. ^ |
  534. {1:~ }|
  535. {1:~ }|
  536. {1:~ }|
  537. |
  538. ]], cmdline={{
  539. firstc = ":",
  540. content = {{"sign jump"}},
  541. pos = 9,
  542. }}, wildmenu_items=expected, wildmenu_pos=1}
  543. feed('<left><left>')
  544. screen:expect{grid=[[
  545. ^ |
  546. {1:~ }|
  547. {1:~ }|
  548. {1:~ }|
  549. |
  550. ]], cmdline={{
  551. firstc = ":",
  552. content = {{"sign "}},
  553. pos = 5,
  554. }}, wildmenu_items=expected, wildmenu_pos=-1}
  555. feed('<right>')
  556. screen:expect{grid=[[
  557. ^ |
  558. {1:~ }|
  559. {1:~ }|
  560. {1:~ }|
  561. |
  562. ]], cmdline={{
  563. firstc = ":",
  564. content = {{"sign define"}},
  565. pos = 11,
  566. }}, wildmenu_items=expected, wildmenu_pos=0}
  567. feed('a')
  568. screen:expect{grid=[[
  569. ^ |
  570. {1:~ }|
  571. {1:~ }|
  572. {1:~ }|
  573. |
  574. ]], cmdline={{
  575. firstc = ":",
  576. content = {{"sign definea"}},
  577. pos = 12,
  578. }}}
  579. end)
  580. it('works together with ext_popupmenu', function()
  581. local expected = {
  582. {'define', '', '', ''},
  583. {'jump', '', '', ''},
  584. {'list', '', '', ''},
  585. {'place', '', '', ''},
  586. {'undefine', '', '', ''},
  587. {'unplace', '', '', ''},
  588. }
  589. command('set wildmode=full')
  590. command('set wildmenu')
  591. screen:set_option('ext_popupmenu', true)
  592. feed(':sign <tab>')
  593. screen:expect{grid=[[
  594. ^ |
  595. {1:~ }|
  596. {1:~ }|
  597. {1:~ }|
  598. |
  599. ]], cmdline={{
  600. firstc = ":",
  601. content = {{"sign define"}},
  602. pos = 11,
  603. }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
  604. feed('<tab>')
  605. screen:expect{grid=[[
  606. ^ |
  607. {1:~ }|
  608. {1:~ }|
  609. {1:~ }|
  610. |
  611. ]], cmdline={{
  612. firstc = ":",
  613. content = {{"sign jump"}},
  614. pos = 9,
  615. }}, popupmenu={items=expected, pos=1, anchor={-1, 0, 5}}}
  616. feed('<left><left>')
  617. screen:expect{grid=[[
  618. ^ |
  619. {1:~ }|
  620. {1:~ }|
  621. {1:~ }|
  622. |
  623. ]], cmdline={{
  624. firstc = ":",
  625. content = {{"sign "}},
  626. pos = 5,
  627. }}, popupmenu={items=expected, pos=-1, anchor={-1, 0, 5}}}
  628. feed('<right>')
  629. screen:expect{grid=[[
  630. ^ |
  631. {1:~ }|
  632. {1:~ }|
  633. {1:~ }|
  634. |
  635. ]], cmdline={{
  636. firstc = ":",
  637. content = {{"sign define"}},
  638. pos = 11,
  639. }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
  640. feed('a')
  641. screen:expect{grid=[[
  642. ^ |
  643. {1:~ }|
  644. {1:~ }|
  645. {1:~ }|
  646. |
  647. ]], cmdline={{
  648. firstc = ":",
  649. content = {{"sign definea"}},
  650. pos = 12,
  651. }}}
  652. feed('<esc>')
  653. -- check positioning with multibyte char in pattern
  654. command("e långfile1")
  655. command("sp långfile2")
  656. feed(':b lå<tab>')
  657. screen:expect{grid=[[
  658. ^ |
  659. {3:långfile2 }|
  660. |
  661. {2:långfile1 }|
  662. |
  663. ]], popupmenu={
  664. anchor = { -1, 0, 2 },
  665. items = {{ "långfile1", "", "", "" }, { "långfile2", "", "", "" }},
  666. pos = 0
  667. }, cmdline={{
  668. content = {{ "b långfile1" }},
  669. firstc = ":",
  670. pos = 12
  671. }}}
  672. end)
  673. it('ext_wildmenu takes precedence over ext_popupmenu', function()
  674. local expected = {
  675. 'define',
  676. 'jump',
  677. 'list',
  678. 'place',
  679. 'undefine',
  680. 'unplace',
  681. }
  682. command('set wildmode=full')
  683. command('set wildmenu')
  684. screen:set_option('ext_wildmenu', true)
  685. screen:set_option('ext_popupmenu', true)
  686. feed(':sign <tab>')
  687. screen:expect{grid=[[
  688. ^ |
  689. {1:~ }|
  690. {1:~ }|
  691. {1:~ }|
  692. |
  693. ]], cmdline={{
  694. firstc = ":",
  695. content = {{"sign define"}},
  696. pos = 11,
  697. }}, wildmenu_items=expected, wildmenu_pos=0}
  698. end)
  699. it("doesn't send invalid events when aborting mapping #10000", function()
  700. command('set notimeout')
  701. command('cnoremap ab c')
  702. feed(':xa')
  703. screen:expect{grid=[[
  704. ^ |
  705. {1:~ }|
  706. {1:~ }|
  707. {1:~ }|
  708. |
  709. ]], cmdline={{
  710. content = { { "x" } },
  711. firstc = ":",
  712. pos = 1,
  713. special = { "a", false }
  714. }}}
  715. -- This used to send an invalid event where pos where larger than the total
  716. -- length of content. Checked in _handle_cmdline_show.
  717. feed('<esc>')
  718. screen:expect([[
  719. ^ |
  720. {1:~ }|
  721. {1:~ }|
  722. {1:~ }|
  723. |
  724. ]])
  725. end)
  726. end
  727. -- the representation of cmdline and cmdline_block contents changed with ext_linegrid
  728. -- (which uses indexed highlights) so make sure to test both
  729. describe('ui/ext_cmdline', function() test_cmdline(true) end)
  730. describe('ui/ext_cmdline (legacy highlights)', function() test_cmdline(false) end)
  731. describe('cmdline redraw', function()
  732. local screen
  733. before_each(function()
  734. clear()
  735. screen = new_screen({rgb=true})
  736. end)
  737. it('with timer', function()
  738. feed(':012345678901234567890123456789')
  739. screen:expect{grid=[[
  740. |
  741. {1:~ }|
  742. {3: }|
  743. :012345678901234567890123|
  744. 456789^ |
  745. ]]}
  746. command('call timer_start(0, {-> 1})')
  747. screen:expect{grid=[[
  748. |
  749. {1:~ }|
  750. {3: }|
  751. :012345678901234567890123|
  752. 456789^ |
  753. ]], unchanged=true, timeout=100}
  754. end)
  755. it('with <Cmd>', function()
  756. if 'openbsd' == helpers.uname() then
  757. pending('FIXME #10804')
  758. end
  759. command('cmap a <Cmd>call sin(0)<CR>') -- no-op
  760. feed(':012345678901234567890123456789')
  761. screen:expect{grid=[[
  762. |
  763. {1:~ }|
  764. {3: }|
  765. :012345678901234567890123|
  766. 456789^ |
  767. ]]}
  768. feed('a')
  769. screen:expect{grid=[[
  770. |
  771. {1:~ }|
  772. {3: }|
  773. :012345678901234567890123|
  774. 456789^ |
  775. ]], unchanged=true}
  776. end)
  777. end)
  778. describe("cmdline height", function()
  779. it("does not crash resized screen #14263", function()
  780. clear()
  781. local screen = Screen.new(25, 10)
  782. screen:attach()
  783. command('set cmdheight=9999')
  784. screen:try_resize(25, 5)
  785. assert_alive()
  786. end)
  787. end)