mirror of
https://github.com/neovim/neovim.git
synced 2026-04-25 08:44:06 +00:00
fix(cmdline): ext_cmdline block events for conditionals
Problem: No block events emitted with ext_cmdline for :if, :while, :try etc.
Solution: Emit cmdline block events; store the indent level of the
previous cmdline and whether a block event was emitted.
This commit is contained in:
committed by
Christian Clason
parent
98c1355e2f
commit
a70ad5cdb6
@@ -865,6 +865,59 @@ local function test_cmdline(linegrid)
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
it('works with conditionals', function()
|
||||
local s1 = [[
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
|
|
||||
]]
|
||||
screen:expect(s1)
|
||||
feed(':if 1<CR>')
|
||||
screen:expect({
|
||||
grid = s1,
|
||||
cmdline = {
|
||||
{
|
||||
content = { { '' } },
|
||||
firstc = ':',
|
||||
indent = 2,
|
||||
pos = 0,
|
||||
},
|
||||
},
|
||||
cmdline_block = { { { 'if 1' } } },
|
||||
})
|
||||
feed(':let x = 1<CR>')
|
||||
screen:expect({
|
||||
grid = s1,
|
||||
cmdline = {
|
||||
{
|
||||
content = { { '' } },
|
||||
firstc = ':',
|
||||
indent = 2,
|
||||
pos = 0,
|
||||
},
|
||||
},
|
||||
cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } },
|
||||
})
|
||||
feed(':endif')
|
||||
screen:expect({
|
||||
grid = s1,
|
||||
cmdline = {
|
||||
{
|
||||
content = { { ':endif' } },
|
||||
firstc = ':',
|
||||
indent = 2,
|
||||
pos = 6,
|
||||
},
|
||||
},
|
||||
cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } },
|
||||
})
|
||||
feed('<CR>')
|
||||
screen:expect({
|
||||
grid = s1,
|
||||
cmdline = { { abort = false } },
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
|
||||
|
||||
Reference in New Issue
Block a user