Merge remote-tracking branch 'lenormf/complete-register-names'

This commit is contained in:
Maxime Coste 2020-02-22 08:39:35 +11:00
commit 93a889bd44

View File

@ -2367,7 +2367,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));