summaryrefslogtreecommitdiffstats
path: root/src/misc2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 649cb65c9b..7ef6cdf44d 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2910,6 +2910,25 @@ find_special_key(
return 0;
}
+
+/*
+ * 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>.
+ */
+ int
+may_remove_shift_modifier(int modifiers, int key)
+{
+ if ((modifiers == MOD_MASK_SHIFT
+ || modifiers == (MOD_MASK_SHIFT | MOD_MASK_ALT)
+ || modifiers == (MOD_MASK_SHIFT | MOD_MASK_META))
+ && ((key >= '@' && key <= 'Z')
+ || key == '^' || key == '_'
+ || (key >= '{' && key <= '~')))
+ return modifiers & ~MOD_MASK_SHIFT;
+ return modifiers;
+}
+
/*
* Try to include modifiers in the key.
* Changes "Shift-a" to 'A', "Alt-A" to 0xc0, etc.