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:')