1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-11 13:00:41 +03:00

Require setting "key" type option to exactly 1 key

(following the example of "codepoint")
This commit is contained in:
Devin J. Pohly 2024-02-26 09:27:12 -06:00
parent 6ecf6bc06b
commit 862718d021
2 changed files with 3 additions and 4 deletions

View File

@ -81,8 +81,7 @@ are exclusively available to built-in options.
*key*::
a single keypress using the same syntax as `map` (see
<<mapping#mappable-keys,`:doc mapping mappable-keys`>>). If
multiple keys are entered, only the first will be used.
<<mapping#mappable-keys,`:doc mapping mappable-keys`>>)
*coord*::
a line, column pair (separated by a comma)

View File

@ -229,8 +229,8 @@ String option_to_string(const Key& key)
Key option_from_string(Meta::Type<Key>, StringView str)
{
auto keys = parse_keys(str);
if (keys.empty())
return Key(Key::Invalid);
if (keys.size() != 1)
throw runtime_error(format("'{}' is not a single key", str));
return keys.front();
}