[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key
From: |
Dima Kogan |
Subject: |
bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords |
Date: |
Sun, 18 Sep 2016 11:25:46 -0700 |
User-agent: |
mu4e 0.9.17; emacs 25.1.1 |
npostavs@users.sourceforge.net writes:
> After applying the patch to emacs-25, I built --with-x-toolkit=lucid and
> --enable-checking; I get an assertion violation when hitting C-n with
> capslock on.
Thanks for testing. I didn't realize that assertions are disabled by
default. Fixed patch attached.
Eli Zaretskii writes:
> Doesn't this mean that ASCII keys will behave differently from
> non-ASCII when Caps Lock is ON?
If you're talking about characters used in non-English languages, then I
really have no idea what the current behavior is, or how to test it. I'm
hoping one of yall who actually use these languages will tell me.
dima
>From 66510839464f0efdc625790f3e64091012408dda Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Sat, 17 Sep 2016 23:47:48 -0700
Subject: [PATCH] Caps-lock doesn't affect interpretation of key chords
* src/keyboard.c (make_lispy_event): when a user pressed key-chords the
caps-lock no longer affects the "shift" state of the generated chord. For
instance Control+s produces C-s regardless of the caps-lock state. And
Control+Shift+s produces C-S-s regardless of the caps-lock state.
---
src/keyboard.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/keyboard.c b/src/keyboard.c
index b8bc361..cd8413b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5417,6 +5417,33 @@ make_lispy_event (struct input_event *event)
{
c &= 0377;
eassert (c == event->code);
+
+ /* Caps-lock shouldn't affect interpretation of key chords:
+ Control+s should produce C-s whether caps-lock is on or
+ not. And Control+Shift+s should produce C-S-s whether
+ caps-lock is on or not. */
+ if (event->modifiers & ~shift_modifier)
+ {
+ /* this is a key chord: some non-shift modifier is
+ depressed */
+
+ if ('A' <= c && c <= 'Z' &&
+ !(event->modifiers & shift_modifier) )
+ {
+ /* Got a capital letter without a shift. The caps
+ lock is on. Un-capitalize the letter */
+ c |= (unsigned)('a' - 'A');
+ }
+ else if (('a' <= c && c <= 'z') &&
+ (event->modifiers & shift_modifier) )
+ {
+ /* Got a lower-case letter even though shift is
+ depressed. The caps lock is on. Capitalize the
+ letter */
+ c &= ~(unsigned)('a' - 'A');
+ }
+ }
+
/* Turn ASCII characters into control characters
when proper. */
if (event->modifiers & ctrl_modifier)
--
2.9.3
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Dima Kogan, 2016/09/18
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, npostavs, 2016/09/18
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords,
Dima Kogan <=
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, npostavs, 2016/09/18
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Eli Zaretskii, 2016/09/18
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Dima Kogan, 2016/09/19
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Eli Zaretskii, 2016/09/19
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Dima Kogan, 2016/09/19
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Eli Zaretskii, 2016/09/19
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Dima Kogan, 2016/09/19
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Eli Zaretskii, 2016/09/21
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Dima Kogan, 2016/09/21
- bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords, Eli Zaretskii, 2016/09/22