From c0cb5db6a4171547d381e8b2a5600bcd6eec86aa Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sun, 9 Feb 2020 15:31:08 +0100 Subject: [PATCH] src: Let `:set-register` complete register names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit allows the `set-register` command to suggest candidates named after punctuated registers, similarly to %reg{…} expansions. --- src/commands.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands.cc b/src/commands.cc index 21ee4d0b..03f8f1f2 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2365,7 +2365,12 @@ const CommandDesc set_register_cmd = { ParameterDesc{{}, ParameterDesc::Flags::SwitchesAsPositional, 1}, CommandFlags::None, CommandHelper{}, - CommandCompleter{}, + make_completer( + [](const Context& context, CompletionFlags flags, + const String& prefix, ByteCount cursor_pos) -> Completions { + return { 0_byte, cursor_pos, + RegisterManager::instance().complete_register_name(prefix, cursor_pos) }; + }), [](const ParametersParser& parser, Context& context, const ShellContext&) { RegisterManager::instance()[parser[0]].set(context, parser.positionals_from(1));