1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-08-17 00:30:26 +03:00

Use menu behavior when completing %opt/%val expansions

Now that the completions include closing delimiters, this is actually
useful because we can type

	echo %val{bufn<ret>

and it will do the right thing.

Don't include register expansions because we currently don't offer
completions for all registers. (We could add that fairly easily.
We'd want to handle some interesting edge cases.  For example query
%reg| should be completed to %reg|:| but also %reg||||.)

File expansions of files that contain a quoting delimiter will be
wrong but that's an unrelated problem, and also pretty minor since
%file{} is rarely used interactively.
This commit is contained in:
Johannes Altmanninger 2022-07-22 11:28:47 +02:00
parent 52b8828a06
commit 09cd7207c0

View File

@ -705,7 +705,9 @@ static Completions complete_expansion(const Context& context, CompletionFlags fl
c += to_string(token.terminator->character);
}
return { start, cursor_pos, candidates };
auto completions_flags = token.type == Token::Type::RegisterExpand
? Completions::Flags::None : Completions::Flags::Menu;
return { start, cursor_pos, candidates, completions_flags };
}
static Completions complete_expand(const Context& context, CompletionFlags flags,