From 4bd34caf4f694b5c66f11d3656c212aad29d244c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 1 Feb 2022 13:36:36 +1100 Subject: [PATCH] Fix modified keys not being mappable in goto mode The test was invalid, non-codepoint keys should be considered mappable. Fixes #4521 --- src/commands.cc | 2 +- test/regression/4521-alt-mapping-broken-in-lower-case-modes/cmd | 1 + test/regression/4521-alt-mapping-broken-in-lower-case-modes/in | 1 + test/regression/4521-alt-mapping-broken-in-lower-case-modes/out | 1 + test/regression/4521-alt-mapping-broken-in-lower-case-modes/rc | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/regression/4521-alt-mapping-broken-in-lower-case-modes/cmd create mode 100644 test/regression/4521-alt-mapping-broken-in-lower-case-modes/in create mode 100644 test/regression/4521-alt-mapping-broken-in-lower-case-modes/out create mode 100644 test/regression/4521-alt-mapping-broken-in-lower-case-modes/rc diff --git a/src/commands.cc b/src/commands.cc index fbedc529..e66c043e 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1816,7 +1816,7 @@ const CommandDesc map_key_cmd = { 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 + if (key[0].codepoint().map(iswupper).value_or(false) and contains(lower_case_only_modes, keymap_mode)) throw runtime_error("mode only supports lower case mappings"); diff --git a/test/regression/4521-alt-mapping-broken-in-lower-case-modes/cmd b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/cmd new file mode 100644 index 00000000..ca1112b5 --- /dev/null +++ b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/cmd @@ -0,0 +1 @@ +gd diff --git a/test/regression/4521-alt-mapping-broken-in-lower-case-modes/in b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/in new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/in @@ -0,0 +1 @@ +foo diff --git a/test/regression/4521-alt-mapping-broken-in-lower-case-modes/out b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/out new file mode 100644 index 00000000..56a2a5ae --- /dev/null +++ b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/out @@ -0,0 +1 @@ +fo diff --git a/test/regression/4521-alt-mapping-broken-in-lower-case-modes/rc b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/rc new file mode 100644 index 00000000..95c82b04 --- /dev/null +++ b/test/regression/4521-alt-mapping-broken-in-lower-case-modes/rc @@ -0,0 +1 @@ +map global goto l