From: Kai Yu Zhang <yeannylam@gmail.com>
To: 21551@debbugs.gnu.org
Subject: bug#21551: [PATCH] Fix Mac OS X key bindings bug
Date: Thu, 24 Sep 2015 21:19:45 +0800 [thread overview]
Message-ID: <CA+B-_B33Z+BgK+10VTjsdMi=rm5cd3-mgzjEr6Jma=UYpA4Yqw@mail.gmail.com> (raw)
[-- 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)
next reply other threads:[~2015-09-24 13:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 13:19 Kai Yu Zhang [this message]
2015-12-30 8:50 ` bug#21551: Fix Mac OS X key bindings bug 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+B-_B33Z+BgK+10VTjsdMi=rm5cd3-mgzjEr6Jma=UYpA4Yqw@mail.gmail.com' \
--to=yeannylam@gmail.com \
--cc=21551@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.