aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-01 07:57:09 +0800
committerGitHub <noreply@github.com>2024-09-01 07:57:09 +0800
commitbfa365a8726788e0a6df85b8f9e620a0904fe529 (patch)
tree34574a23948fe5fcfd4c7a358df8827e2acb8fc6
parentf046c3eca62d82078fb53d04e0665fa84f06ecca (diff)
downloadrneovim-bfa365a8726788e0a6df85b8f9e620a0904fe529.tar.gz
rneovim-bfa365a8726788e0a6df85b8f9e620a0904fe529.tar.bz2
rneovim-bfa365a8726788e0a6df85b8f9e620a0904fe529.zip
fix(completion): don't include <Lua function> in -complete= (#30209)
-rw-r--r--src/nvim/usercmd.c2
-rw-r--r--test/functional/editor/completion_spec.lua8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 6bff66dca2..3eb67a21f0 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -415,7 +415,7 @@ char *get_user_cmd_complete(expand_T *xp, int idx)
return NULL;
}
char *cmd_compl = get_command_complete(idx);
- if (cmd_compl == NULL) {
+ if (cmd_compl == NULL || idx == EXPAND_USER_LUA) {
return "";
}
return cmd_compl;
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index 3f19596bd7..d543de4acd 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -4,7 +4,7 @@ local Screen = require('test.functional.ui.screen')
local assert_alive = n.assert_alive
local clear, feed = n.clear, n.feed
-local eval, eq, neq = n.eval, t.eq, t.neq
+local eval, eq, neq, ok = n.eval, t.eq, t.neq, t.ok
local feed_command, source, expect = n.feed_command, n.source, n.expect
local fn = n.fn
local command = n.command
@@ -947,6 +947,12 @@ describe('completion', function()
eq('SpecialKey', fn.getcompletion('set winhighlight=NonText:', 'cmdline')[1])
end)
+ it('cmdline completion for -complete does not contain spaces', function()
+ for _, str in ipairs(fn.getcompletion('command -complete=', 'cmdline')) do
+ ok(not str:find(' '), 'string without spaces', str)
+ end
+ end)
+
describe('from the commandline window', function()
it('is cleared after CTRL-C', function()
feed('q:')