aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2025-03-13 13:47:48 +0100
committerChristian Clason <ch.clason+github@icloud.com>2025-03-15 12:09:22 +0100
commita70ad5cdb6de024f2efd1885107cb89c135515e3 (patch)
treec2061886b8a488244f500e1114b3dc4762ec3ebd /test/functional
parent98c1355e2f2236bcbad7f8f513d3c11237040293 (diff)
downloadrneovim-a70ad5cdb6de024f2efd1885107cb89c135515e3.tar.gz
rneovim-a70ad5cdb6de024f2efd1885107cb89c135515e3.tar.bz2
rneovim-a70ad5cdb6de024f2efd1885107cb89c135515e3.zip
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.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/ui/cmdline_spec.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index ce7c9596bb..cb9d978a0f 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -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