aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/syntax_conceal_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
commit9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch)
tree607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /test/functional/ui/syntax_conceal_spec.lua
parent9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff)
parent3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff)
downloadrneovim-9243becbedbb6a1592208051f8fa2b090dcc5e7d.tar.gz
rneovim-9243becbedbb6a1592208051f8fa2b090dcc5e7d.tar.bz2
rneovim-9243becbedbb6a1592208051f8fa2b090dcc5e7d.zip
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'test/functional/ui/syntax_conceal_spec.lua')
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua85
1 files changed, 61 insertions, 24 deletions
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index f790597140..1391985823 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -4,7 +4,7 @@ local clear, feed, command = helpers.clear, helpers.feed, helpers.command
local eq = helpers.eq
local insert = helpers.insert
local poke_eventloop = helpers.poke_eventloop
-local expect_exit = helpers.expect_exit
+local exec = helpers.exec
describe('Screen', function()
local screen
@@ -947,7 +947,7 @@ describe('Screen', function()
{0:~ }|
|
]]}
- eq({{2, 0, {{'c', 0, 3}}}}, grid_lines)
+ eq({{2, 0, {{'c', 0, 3}, {' ', 0, 50}}}, {3, 0, {{' ', 0, 53}}}}, grid_lines)
end)
it('K_EVENT should not cause extra redraws with concealcursor #13196', function()
@@ -994,31 +994,39 @@ describe('Screen', function()
{0:~ }|
|
]]}
- eq({{2, 0, {{'c', 0, 3}}}}, grid_lines)
+ eq({{2, 0, {{'c', 0, 3}, {' ', 0, 50}}}}, grid_lines)
+ grid_lines = {}
poke_eventloop() -- causes K_EVENT key
screen:expect_unchanged()
- eq({{2, 0, {{'c', 0, 3}}}}, grid_lines)
+ eq({}, grid_lines) -- no redraw was done
end)
- -- Copy of Test_cursor_column_in_concealed_line_after_window_scroll in
- -- test/functional/ui/syntax_conceal_spec.lua.
- describe('concealed line after window scroll', function()
- after_each(function()
- expect_exit(command, ':qall!')
- os.remove('Xcolesearch')
- end)
-
- it('has the correct cursor column', function()
+ describe('concealed line has the correct cursor column', function()
+ -- oldtest: Test_cursor_column_in_concealed_line_after_window_scroll()
+ it('after window scroll', function()
insert([[
- 3split
- let m = matchadd('Conceal', '=')
- setl conceallevel=2 concealcursor=nc
- normal gg
- "==expr==
- ]])
+ 3split
+ let m = matchadd('Conceal', '=')
+ setl conceallevel=2 concealcursor=nc
+ normal gg
+ "==expr==]])
+ feed('gg')
+ command('file Xcolesearch')
+ command('set nomodified')
- command('write Xcolesearch')
- feed(":so %<CR>")
+ command('so')
+ screen:expect{grid=[[
+ ^3split |
+ let m matchadd('Conceal', '') |
+ setl conceallevel2 concealcursornc |
+ {2:Xcolesearch }|
+ 3split |
+ let m = matchadd('Conceal', '=') |
+ setl conceallevel=2 concealcursor=nc |
+ normal gg |
+ {3:Xcolesearch }|
+ |
+ ]]}
-- Jump to something that is beyond the bottom of the window,
-- so there's a scroll down.
@@ -1032,13 +1040,42 @@ describe('Screen', function()
normal gg |
"{5:^expr} |
{2:Xcolesearch }|
+ 3split |
+ let m = matchadd('Conceal', '=') |
+ setl conceallevel=2 concealcursor=nc |
normal gg |
- "=={5:expr}== |
- |
- {0:~ }|
{3:Xcolesearch }|
/expr |
]]}
end)
+
+ -- oldtest: Test_cursor_column_in_concealed_line_after_leftcol_change()
+ it('after leftcol change', function()
+ exec([[
+ 0put = 'ab' .. repeat('-', &columns) .. 'c'
+ call matchadd('Conceal', '-')
+ set nowrap ss=0 cole=3 cocu=n
+ ]])
+
+ -- Go to the end of the line (3 columns beyond the end of the screen).
+ -- Horizontal scroll would center the cursor in the screen line, but conceal
+ -- makes it go to screen column 1.
+ feed('$')
+
+ -- Are the concealed parts of the current line really hidden?
+ -- Is the window's cursor column properly updated for conceal?
+ screen:expect{grid=[[
+ ^c |
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end)
end)
end)