neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit bfa365a8726788e0a6df85b8f9e620a0904fe529
parent f046c3eca62d82078fb53d04e0665fa84f06ecca
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun,  1 Sep 2024 07:57:09 +0800

fix(completion): don't include <Lua function> in -complete= (#30209)


Diffstat:
Msrc/nvim/usercmd.c | 2+-
Mtest/functional/editor/completion_spec.lua | 8+++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 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 @@ -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:')