mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
test(ui/mouse_spec): mouse click with matchadd() concealed text
This commit is contained in:
@@ -1073,38 +1073,7 @@ describe('ui/mouse/input', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
describe('on concealed text', function()
|
||||
-- Helpful for reading the test expectations:
|
||||
-- :match Error /\^/
|
||||
|
||||
before_each(function()
|
||||
screen:try_resize(25, 7)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
|
||||
sm = {bold = true},
|
||||
})
|
||||
feed('ggdG')
|
||||
|
||||
command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]])
|
||||
command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]])
|
||||
command([[syntax match X2 /cats/ conceal cchar=X contained]])
|
||||
command([[syntax match X3 /\n\@<=x/ conceal cchar=>]])
|
||||
command([[highlight link X0 Normal]])
|
||||
command([[highlight link X1 NonText]])
|
||||
command([[highlight link X2 NonText]])
|
||||
command([[highlight link X3 NonText]])
|
||||
|
||||
-- First column is there to retain the tabs.
|
||||
insert([[
|
||||
|Section *t1*
|
||||
| *t2* *t3* *t4*
|
||||
|x 私は猫が大好き *cats* ✨🐈✨
|
||||
]])
|
||||
|
||||
feed('gg<c-v>Gxgg')
|
||||
end)
|
||||
|
||||
local function test_mouse_click_conceal()
|
||||
it('(level 1) click on non-wrapped lines', function()
|
||||
feed_command('let &conceallevel=1', 'echo')
|
||||
|
||||
@@ -1637,6 +1606,75 @@ describe('ui/mouse/input', function()
|
||||
]])
|
||||
|
||||
end) -- level 3 - wrapped
|
||||
end
|
||||
|
||||
describe('on concealed text', function()
|
||||
-- Helpful for reading the test expectations:
|
||||
-- :match Error /\^/
|
||||
|
||||
before_each(function()
|
||||
screen:try_resize(25, 7)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = { bold = true, foreground = Screen.colors.Blue },
|
||||
c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
|
||||
sm = { bold = true },
|
||||
})
|
||||
feed('ggdG')
|
||||
|
||||
command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]])
|
||||
command([[highlight link X0 Normal]])
|
||||
command([[highlight link X1 NonText]])
|
||||
command([[highlight link X2 NonText]])
|
||||
command([[highlight link X3 NonText]])
|
||||
|
||||
-- First column is there to retain the tabs.
|
||||
insert([[
|
||||
|Section *t1*
|
||||
| *t2* *t3* *t4*
|
||||
|x 私は猫が大好き *cats* ✨🐈✨
|
||||
]])
|
||||
|
||||
feed('gg<c-v>Gxgg')
|
||||
end)
|
||||
|
||||
describe('(syntax)', function()
|
||||
before_each(function()
|
||||
command([[syntax region X0 matchgroup=X1 start=/\*/ end=/\*/ concealends contains=X2]])
|
||||
command([[syntax match X2 /cats/ conceal cchar=X contained]])
|
||||
command([[syntax match X3 /\n\@<=x/ conceal cchar=>]])
|
||||
end)
|
||||
test_mouse_click_conceal()
|
||||
end)
|
||||
|
||||
describe('(matchadd())', function()
|
||||
before_each(function()
|
||||
funcs.matchadd('Conceal', [[\*]])
|
||||
funcs.matchadd('Conceal', [[cats]], 10, -1, { conceal = 'X' })
|
||||
funcs.matchadd('Conceal', [[\n\@<=x]], 10, -1, { conceal = '>' })
|
||||
end)
|
||||
test_mouse_click_conceal()
|
||||
end)
|
||||
|
||||
-- FIXME: cannot make extmark conceal behave exactly like syntax conceal without cchar
|
||||
pending('(extmarks)', function()
|
||||
before_each(function()
|
||||
local ns = meths.create_namespace('conceal')
|
||||
meths.buf_set_extmark(0, ns, 0, 11, { end_col = 12, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 0, 14, { end_col = 15, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 5, { end_col = 6, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 8, { end_col = 9, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 10, { end_col = 11, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 13, { end_col = 14, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 15, { end_col = 16, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 1, 18, { end_col = 19, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 2, 24, { end_col = 25, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 2, 29, { end_col = 30, conceal = '' })
|
||||
meths.buf_set_extmark(0, ns, 2, 25, { end_col = 29, conceal = 'X' })
|
||||
meths.buf_set_extmark(0, ns, 2, 0, { end_col = 1, conceal = '>' })
|
||||
end)
|
||||
test_mouse_click_conceal()
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
it('getmousepos works correctly', function()
|
||||
|
Reference in New Issue
Block a user