aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-01 20:37:45 +0800
committerGitHub <noreply@github.com>2022-04-01 20:37:45 +0800
commitfce0d54eb2bcfff6903649ab093603dcd8f21f23 (patch)
tree2367f938b1e7efea4850f4dea8dbb4ca6ef6192e /test
parent377e87521157947c384d470a63927719b8c73ad7 (diff)
parentef595e9b93c3841511d8511e11b001e4162a2998 (diff)
downloadrneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.tar.gz
rneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.tar.bz2
rneovim-fce0d54eb2bcfff6903649ab093603dcd8f21f23.zip
Merge pull request #17953 from zeertzjq/vim-8.2.4660
vim-patch:8.2.4660: cursorcolumn is sometimes not correct
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/highlight_spec.lua40
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua34
2 files changed, 71 insertions, 3 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index bf52d9f9b4..4b63b09a5b 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -1306,14 +1306,48 @@ describe('CursorLine and CursorLineNr highlights', function()
end)
describe('CursorColumn highlight', function()
- before_each(clear)
- it('is updated if cursor is moved from timer', function()
- local screen = Screen.new(50, 8)
+ local screen
+ before_each(function()
+ clear()
+ screen = Screen.new(50, 8)
screen:set_default_attr_ids({
[1] = {background = Screen.colors.Gray90}, -- CursorColumn
[2] = {bold = true, foreground = Screen.colors.Blue1}, -- NonText
+ [3] = {bold = true}, -- ModeMsg
})
screen:attach()
+ end)
+
+ it('is updated when pressing "i" on a TAB character', function()
+ exec([[
+ call setline(1, ['123456789', "a\tb"])
+ set cursorcolumn
+ call cursor(2, 2)
+ ]])
+ screen:expect([[
+ 1234567{1:8}9 |
+ a ^ b |
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ |
+ ]])
+ feed('i')
+ screen:expect([[
+ 1{1:2}3456789 |
+ a^ b |
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end)
+
+ it('is updated if cursor is moved from timer', function()
exec([[
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
set cursorcolumn
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index 92e5a5dd94..9d10c55cb6 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -256,6 +256,40 @@ describe('Screen', function()
]])
end)
end) -- a region of text (implicit concealing)
+
+ it("cursor position is correct when entering Insert mode with cocu=ni #13916", function()
+ insert([[foobarfoobarfoobar]])
+ -- move to end of line
+ feed("$")
+ command("set concealcursor=ni")
+ command("syn match Foo /foobar/ conceal cchar=&")
+ screen:expect([[
+ {1:&&&}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed("i")
+ -- cursor should stay in place, not jump to column 16
+ screen:expect([[
+ {1:&&&}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {4:-- INSERT --} |
+ ]])
+ end)
end) -- match and conceal
describe("let the conceal level be", function()