cursorbind_spec.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. before_each(clear)
  8. describe("'cursorbind'", function()
  9. -- oldtest: Test_cursorline_cursorbind_horizontal_scroll()
  10. it("behaves consistently whether 'cursorline' is set or not vim-patch:8.2.4795", function()
  11. local screen = Screen.new(60, 8)
  12. screen:set_default_attr_ids({
  13. [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
  14. [2] = { bold = true, reverse = true }, -- StatusLine
  15. [3] = { reverse = true }, -- StatusLineNC
  16. [4] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn
  17. })
  18. exec([[
  19. call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' ..
  20. \ ' nn oo pp qq rr ss tt uu vv ww xx yy zz')
  21. set nowrap
  22. " The following makes the cursor apparent on the screen dump
  23. set sidescroll=1 cursorcolumn
  24. " add empty lines, required for cursorcolumn
  25. call append(1, ['','','',''])
  26. 20vsp
  27. windo :set cursorbind
  28. ]])
  29. feed('20l')
  30. screen:expect([[
  31. a bb cc dd ee ff gg │aa bb cc dd ee ff gg^ hh ii jj kk ll mm |
  32. {4: }│ {4: } |*4
  33. {1:~ }│{1:~ }|
  34. {3:[No Name] [+] }{2:[No Name] [+] }|
  35. |
  36. ]])
  37. feed('10l')
  38. screen:expect([[
  39. hh ii jj kk ll mm n│aa bb cc dd ee ff gg hh ii jj ^kk ll mm |
  40. {4: } │ {4: } |*4
  41. {1:~ }│{1:~ }|
  42. {3:[No Name] [+] }{2:[No Name] [+] }|
  43. |
  44. ]])
  45. command('windo :set cursorline')
  46. feed('0')
  47. feed('20l')
  48. screen:expect([[
  49. {4:a bb cc dd ee ff gg }│{4:aa bb cc dd ee ff gg^ hh ii jj kk ll mm }|
  50. {4: }│ {4: } |*4
  51. {1:~ }│{1:~ }|
  52. {3:[No Name] [+] }{2:[No Name] [+] }|
  53. |
  54. ]])
  55. feed('10l')
  56. screen:expect([[
  57. {4: hh ii jj kk ll mm n}│{4:aa bb cc dd ee ff gg hh ii jj ^kk ll mm }|
  58. {4: } │ {4: } |*4
  59. {1:~ }│{1:~ }|
  60. {3:[No Name] [+] }{2:[No Name] [+] }|
  61. |
  62. ]])
  63. command('windo :set nocursorline nocursorcolumn')
  64. feed('0')
  65. feed('40l')
  66. screen:expect([[
  67. kk ll mm nn oo pp qq│ bb cc dd ee ff gg hh ii jj kk ll mm n^n|
  68. │ |*4
  69. {1:~ }│{1:~ }|
  70. {3:[No Name] [+] }{2:[No Name] [+] }|
  71. |
  72. ]])
  73. end)
  74. end)