GNU bug report logs -
#24456
25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Sun, 18 Sep 2016 07:02:02 UTC
Severity: minor
Tags: patch
Merged with 4931,
7637,
17781
Found in versions 24.0.50, 24.3, 25.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
> Thanks. However, this doesn't look right to me: your code is entirely
> inside the following condition:
>
> if (event->kind == ASCII_KEYSTROKE_EVENT)
>
> So it will not do anything for non-ASCII keystrokes. You should move
> the code out of that condition, I think.
>
>> + if (uppercasep(c) &&
>> + !(event->modifiers & shift_modifier) )
>
> A nit: our coding standards request a space between the function name
> and the opening parenthesis that follows it, and no spaces between
> closing parentheses.
OK. How about this?
[0001-Caps-lock-doesn-t-affect-interpretation-of-key-chord.patch (text/x-diff, inline)]
From e3a0375ea66a746a6a02e94f85ef71bf7fe9db5d Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> 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 | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/keyboard.c b/src/keyboard.c
index b8bc361..e8a199d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5417,6 +5417,37 @@ 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 (uppercasep (c) &&
+ !(event->modifiers & shift_modifier))
+ {
+ /* Got a capital letter without a shift. The caps
+ lock is on. Un-capitalize the letter */
+ c = downcase(c);
+ }
+ else if (lowercasep (c) &&
+ (event->modifiers & shift_modifier))
+ {
+ /* Got a lower-case letter even though shift is
+ depressed. The caps lock is on. Capitalize the
+ letter */
+ c = upcase(c);
+ }
+ }
+
+ if (event->kind == ASCII_KEYSTROKE_EVENT)
+ {
/* Turn ASCII characters into control characters
when proper. */
if (event->modifiers & ctrl_modifier)
--
2.9.3
This bug report was last modified 8 years and 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.