summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 3781dd85d..b69714a8d 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2947,6 +2947,32 @@ find_special_key(
/*
+ * Some keys are used with Ctrl without Shift and are still expected to be
+ * mapped as if Shift was pressed:
+ * CTRL-2 is CTRL-@
+ * CTRL-6 is CTRL-^
+ * CTRL-- is CTRL-_
+ * Also, <C-H> and <C-h> mean the same thing, always use "H".
+ * Returns the possibly adjusted key.
+ */
+ int
+may_adjust_key_for_ctrl(int modifiers, int key)
+{
+ if (modifiers & MOD_MASK_CTRL)
+ {
+ if (ASCII_ISALPHA(key))
+ return TOUPPER_ASC(key);
+ if (key == '2')
+ return '@';
+ if (key == '6')
+ return '^';
+ if (key == '-')
+ return '_';
+ }
+ return key;
+}
+
+/*
* Some keys already have Shift included, pass them as normal keys.
* Not when Ctrl is also used, because <C-H> and <C-S-H> are different.
* Also for <A-S-a> and <M-S-a>.