visual_spec.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. local n = require('test.functional.testnvim')()
  2. local Screen = require('test.functional.ui.screen')
  3. local clear = n.clear
  4. local feed = n.feed
  5. local exec = n.exec
  6. before_each(clear)
  7. describe('Visual highlight', function()
  8. local screen
  9. before_each(function()
  10. screen = Screen.new(50, 6)
  11. end)
  12. -- oldtest: Test_visual_block_with_virtualedit()
  13. it('shows selection correctly with virtualedit=block', function()
  14. exec([[
  15. call setline(1, ['aaaaaa', 'bbbb', 'cc'])
  16. set virtualedit=block
  17. normal G
  18. ]])
  19. feed('<C-V>gg$')
  20. screen:expect([[
  21. {17:aaaaaa}^ |
  22. {17:bbbb } |
  23. {17:cc } |
  24. {1:~ }|*2
  25. {5:-- VISUAL BLOCK --} |
  26. ]])
  27. feed('<Esc>gg<C-V>G$')
  28. screen:expect([[
  29. {17:aaaaaa } |
  30. {17:bbbb } |
  31. {17:cc}^ {17: } |
  32. {1:~ }|*2
  33. {5:-- VISUAL BLOCK --} |
  34. ]])
  35. end)
  36. -- oldtest: Test_visual_hl_with_showbreak()
  37. it("with cursor at end of screen line and 'showbreak'", function()
  38. exec([[
  39. setlocal showbreak=+
  40. call setline(1, repeat('a', &columns + 10))
  41. normal g$v4lo
  42. ]])
  43. screen:expect([[
  44. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
  45. {1:+}{17:aaaa}aaaaaa |
  46. {1:~ }|*3
  47. {5:-- VISUAL --} |
  48. ]])
  49. end)
  50. end)