Restore goto case insensitiveness, refuse to map upper case

After a while it seems clear changing this is much more ergonomic
and restoring it with pure config is impractical as we need to map
all lower case keys.
This commit is contained in:
Maxime Coste 2022-01-23 21:00:45 +11:00
parent 9acd4e62dc
commit f4ff59f8b2
2 changed files with 6 additions and 1 deletions

View File

@ -1815,6 +1815,11 @@ const CommandDesc map_key_cmd = {
if (key.size() != 1) if (key.size() != 1)
throw runtime_error("only a single key can be mapped"); throw runtime_error("only a single key can be mapped");
KeymapMode lower_case_only_modes[] = {KeymapMode::Goto};
if (key[0].codepoint().map(iswupper).value_or(true) and
contains(lower_case_only_modes, keymap_mode))
throw runtime_error("mode only supports lower case mappings");
KeyList mapping = parse_keys(parser[3]); KeyList mapping = parse_keys(parser[3]);
keymaps.map_key(key[0], keymap_mode, std::move(mapping), keymaps.map_key(key[0], keymap_mode, std::move(mapping),
trim_indent(parser.get_switch("docstring").value_or(""))); trim_indent(parser.get_switch("docstring").value_or("")));

View File

@ -228,7 +228,7 @@ void goto_commands(Context& context, NormalParams params)
if (not cp or key == Key::Escape) if (not cp or key == Key::Escape)
return; return;
auto& buffer = context.buffer(); auto& buffer = context.buffer();
switch (*cp) switch (to_lower(*cp))
{ {
case 'g': case 'g':
case 'k': case 'k':