aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/cursorbind_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-21 06:57:13 +0800
committerGitHub <noreply@github.com>2022-04-21 06:57:13 +0800
commitc6dcc6acd84adbaed8e6bcba0cb5e42bffdf1732 (patch)
tree87d2a92a9eac8deeccf1c896d4f20bca0b04f7d7 /test/functional/options/cursorbind_spec.lua
parent61eca90f653f6788374c2c5c177d809e6bb5a40c (diff)
parent94f12e8a5947a31a3fca07c8df75ab62fef7b1a3 (diff)
downloadrneovim-c6dcc6acd84adbaed8e6bcba0cb5e42bffdf1732.tar.gz
rneovim-c6dcc6acd84adbaed8e6bcba0cb5e42bffdf1732.tar.bz2
rneovim-c6dcc6acd84adbaed8e6bcba0cb5e42bffdf1732.zip
Merge pull request #18189 from zeertzjq/vim-8.2.4795
vim-patch:8.2.{4795,4796,4801}: 'cursorbind' scrolling depends on whether 'cursorline' is set
Diffstat (limited to 'test/functional/options/cursorbind_spec.lua')
-rw-r--r--test/functional/options/cursorbind_spec.lua91
1 files changed, 91 insertions, 0 deletions
diff --git a/test/functional/options/cursorbind_spec.lua b/test/functional/options/cursorbind_spec.lua
new file mode 100644
index 0000000000..f762808dd6
--- /dev/null
+++ b/test/functional/options/cursorbind_spec.lua
@@ -0,0 +1,91 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local exec = helpers.exec
+local feed = helpers.feed
+
+before_each(clear)
+
+describe("'cursorbind'", function()
+ 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, VertSplit
+ [4] = {background = Screen.colors.Grey90}, -- CursorLine, CursorColumn
+ })
+ screen:attach()
+ 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 {3:│}aa bb cc dd ee ff gg^ hh ii jj kk ll mm |
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {1:~ }{3:│}{1:~ }|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ |
+ ]])
+ feed('10l')
+ screen:expect([[
+ hh ii jj kk ll mm n{3:│}aa bb cc dd ee ff gg hh ii jj ^kk ll mm |
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {1:~ }{3:│}{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 }{3:│}{4:aa bb cc dd ee ff gg^ hh ii jj kk ll mm }|
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {4: }{3:│} {4: } |
+ {1:~ }{3:│}{1:~ }|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ |
+ ]])
+ feed('10l')
+ screen:expect([[
+ {4: hh ii jj kk ll mm n}{3:│}{4:aa bb cc dd ee ff gg hh ii jj ^kk ll mm }|
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {4: } {3:│} {4: } |
+ {1:~ }{3:│}{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{3:│} bb cc dd ee ff gg hh ii jj kk ll mm n^n|
+ {3:│} |
+ {3:│} |
+ {3:│} |
+ {3:│} |
+ {1:~ }{3:│}{1:~ }|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ |
+ ]])
+ end)
+end)