unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21551: [PATCH] Fix Mac OS X key bindings bug
@ 2015-09-24 13:19 Kai Yu Zhang
  2015-12-30  8:50 ` bug#21551: " Anders Lindgren
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Yu Zhang @ 2015-09-24 13:19 UTC (permalink / raw)
  To: 21551


[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 26 bytes --]

[-- Attachment #2: 0001-Fix-Mac-OS-X-key-bindings-bug.patch --]
[-- Type: application/octet-stream, Size: 3358 bytes --]

From c080da382e3d9e60f396eed4364558611e150e8d Mon Sep 17 00:00:00 2001
From: Zhang Kai Yu <yeannylam@gmail.com>
Date: Thu, 24 Sep 2015 21:10:40 +0800
Subject: [PATCH] Fix Mac OS X key bindings bug

---
 src/nsterm.m | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 7c6b9dc..d1ccc8a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5383,16 +5383,18 @@ not_in_argv (NSString *arg)
           emacs_event->modifiers |= parse_solitary_modifier
             (ns_command_modifier);
 
-          /* if super (default), take input manager's word so things like
-             dvorak / qwerty layout work */
+          /* we should use [theEvent charactersIgnoringModifiers] rather than
+           * [theEvent characters], otherwise the key code will become
+           * extremely big and cause bug when doing key bindings.
+           */
           if (EQ (ns_command_modifier, Qsuper)
               && !fnKeysym
-              && [[theEvent characters] length] != 0)
+              && [[theEvent charactersIgnoringModifiers] length] != 0)
             {
               /* XXX: the code we get will be unshifted, so if we have
                  a shift modifier, must convert ourselves */
               if (!(flags & NSShiftKeyMask))
-                code = [[theEvent characters] characterAtIndex: 0];
+                code = [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
 #if 0
               /* this is ugly and also requires linking w/Carbon framework
                  (for LMGetKbdType) so for now leave this rare (?) case
@@ -5449,8 +5451,9 @@ not_in_argv (NSString *arg)
                || (EQ (ns_right_alternate_modifier, Qleft) && left_is_none))
               && !fnKeysym)
             {   /* accept pre-interp alt comb */
-              if ([[theEvent characters] length] > 0)
-                code = [[theEvent characters] characterAtIndex: 0];
+              if ([[theEvent charactersIgnoringModifiers] length] > 0)
+                code = [[theEvent charactersIgnoringModifiers]
+                  characterAtIndex: 0];
               /*HACK: clear lone shift modifier to stop next if from firing */
               if (emacs_event->modifiers == shift_modifier)
                 emacs_event->modifiers = 0;
@@ -5466,8 +5469,9 @@ not_in_argv (NSString *arg)
         {
           if (left_is_none && !fnKeysym)
             {   /* accept pre-interp alt comb */
-              if ([[theEvent characters] length] > 0)
-                code = [[theEvent characters] characterAtIndex: 0];
+              if ([[theEvent charactersIgnoringModifiers] length] > 0)
+                code = [[theEvent charactersIgnoringModifiers]
+                  characterAtIndex: 0];
               /*HACK: clear lone shift modifier to stop next if from firing */
               if (emacs_event->modifiers == shift_modifier)
                 emacs_event->modifiers = 0;
@@ -5485,7 +5489,6 @@ not_in_argv (NSString *arg)
       if (fnKeysym || (emacs_event->modifiers
                        && (emacs_event->modifiers != shift_modifier)
                        && [[theEvent charactersIgnoringModifiers] length] > 0))
-/*[[theEvent characters] length] */
         {
           emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
           if (code < 0x20)
-- 
2.3.8 (Apple Git-58)


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-02-19 15:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 13:19 bug#21551: [PATCH] Fix Mac OS X key bindings bug Kai Yu Zhang
2015-12-30  8:50 ` bug#21551: " Anders Lindgren
2016-01-02  8:08   ` Anders Lindgren
2016-12-26 20:12     ` bug#19977: " Mikhail Gusarov
2018-02-11 17:57     ` bug#21551: " Philipp Stephani
2018-02-13 18:56       ` Alan Third
2018-02-14 21:44         ` Alan Third
2018-02-17 12:36           ` Alan Third
2018-02-18 21:59           ` Philipp Stephani
2018-02-19 15:05             ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).