aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/cursorbind_spec.lua
blob: 21e0ba8e75302076cef7662040309d592b560100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')

local clear = n.clear
local command = n.command
local exec = n.exec
local feed = n.feed

before_each(clear)

describe("'cursorbind'", function()
  -- oldtest: Test_cursorline_cursorbind_horizontal_scroll()
  it("behaves consistently whether 'cursorline' is set or not vim-patch:8.2.4795", function()
    local screen = Screen.new(60, 8)
    screen:set_default_attr_ids({
      [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
      [2] = { bold = true, reverse = true }, -- StatusLine
      [3] = { reverse = true }, -- StatusLineNC
      [4] = { background = Screen.colors.Grey90 }, -- CursorLine, CursorColumn
    })
    exec([[
      call setline(1, 'aa bb cc dd ee ff gg hh ii jj kk ll mm' ..
      \ ' nn oo pp qq rr ss tt uu vv ww xx yy zz')
      set nowrap
      " The following makes the cursor apparent on the screen dump
      set sidescroll=1 cursorcolumn
      " add empty lines, required for cursorcolumn
      call append(1, ['','','',''])
      20vsp
      windo :set cursorbind
    ]])
    feed('20l')
    screen:expect([[
      a bb cc dd ee ff gg │aa bb cc dd ee ff gg^ hh ii jj kk ll mm |
                         {4: }│                    {4: }                  |*4
      {1:~                   }│{1:~                                      }|
      {3:[No Name] [+]        }{2:[No Name] [+]                          }|
                                                                  |
    ]])
    feed('10l')
    screen:expect([[
       hh ii jj kk ll mm n│aa bb cc dd ee ff gg hh ii jj ^kk ll mm |
                {4: }         │                              {4: }        |*4
      {1:~                   }│{1:~                                      }|
      {3:[No Name] [+]        }{2:[No Name] [+]                          }|
                                                                  |
    ]])
    command('windo :set cursorline')
    feed('0')
    feed('20l')
    screen:expect([[
      {4:a bb cc dd ee ff gg }│{4:aa bb cc dd ee ff gg^ hh ii jj kk ll mm }|
                         {4: }│                    {4: }                  |*4
      {1:~                   }│{1:~                                      }|
      {3:[No Name] [+]        }{2:[No Name] [+]                          }|
                                                                  |
    ]])
    feed('10l')
    screen:expect([[
      {4: hh ii jj kk ll mm n}│{4:aa bb cc dd ee ff gg hh ii jj ^kk ll mm }|
                {4: }         │                              {4: }        |*4
      {1:~                   }│{1:~                                      }|
      {3:[No Name] [+]        }{2:[No Name] [+]                          }|
                                                                  |
    ]])
    command('windo :set nocursorline nocursorcolumn')
    feed('0')
    feed('40l')
    screen:expect([[
      kk ll mm nn oo pp qq│ bb cc dd ee ff gg hh ii jj kk ll mm n^n|
                          │                                       |*4
      {1:~                   }│{1:~                                      }|
      {3:[No Name] [+]        }{2:[No Name] [+]                          }|
                                                                  |
    ]])
  end)
end)