tabline_spec.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. local n = require('test.functional.testnvim')()
  2. local Screen = require('test.functional.ui.screen')
  3. local clear = n.clear
  4. local exec = n.exec
  5. local feed = n.feed
  6. before_each(clear)
  7. describe('tabline', function()
  8. local screen
  9. before_each(function()
  10. screen = Screen.new(50, 7)
  11. end)
  12. -- oldtest: Test_tabline_showcmd()
  13. it('showcmdloc=tabline works', function()
  14. exec([[
  15. func MyTabLine()
  16. return '%S'
  17. endfunc
  18. set showcmd
  19. set showtabline=2
  20. set tabline=%!MyTabLine()
  21. set showcmdloc=tabline
  22. call setline(1, ['a', 'b', 'c'])
  23. set foldopen+=jump
  24. 1,2fold
  25. 3
  26. ]])
  27. feed('g')
  28. screen:expect([[
  29. {2:g }|
  30. {13:+-- 2 lines: a···································}|
  31. ^c |
  32. {1:~ }|*3
  33. |
  34. ]])
  35. -- typing "gg" should open the fold
  36. feed('g')
  37. screen:expect([[
  38. {2: }|
  39. ^a |
  40. b |
  41. c |
  42. {1:~ }|*2
  43. |
  44. ]])
  45. feed('<C-V>Gl')
  46. screen:expect([[
  47. {2:3x2 }|
  48. {17:a} |
  49. {17:b} |
  50. {17:c}^ |
  51. {1:~ }|*2
  52. {5:-- VISUAL BLOCK --} |
  53. ]])
  54. feed('<Esc>1234')
  55. screen:expect([[
  56. {2:1234 }|
  57. a |
  58. b |
  59. ^c |
  60. {1:~ }|*2
  61. |
  62. ]])
  63. feed('<Esc>:set tabline=<CR>')
  64. feed(':<CR>')
  65. feed('1234')
  66. screen:expect([[
  67. {5: + [No Name] }{2: }{24:1234}{2: }|
  68. a |
  69. b |
  70. ^c |
  71. {1:~ }|*2
  72. : |
  73. ]])
  74. end)
  75. end)