Subject: bug#11041: 23.4; Shifted keystrokes are not passed into OS X Input Manager correctly

From: Yong-Gang Wang <[email-masked]>
Date: Sun, 18 Mar 2012 12:23:23 +0800

In GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2012-01-29 on bob.porkrind.org

Repro: On Mac OS X, turns a CJK input method on, e.g. Chinese Pinyin Input
Method, then types shifted characters like ":", "?", "<" or ">" in GNU
Emacs OS X 23.4.1.
Expected results: Chinese fullwidth punctuations are input, like "：", "？",
"《" or "》".
Actual results: English halfwidth punctuations are input, ":", "?", "<" or
">".

Debug and Code location:

See src/nsterm.m line 4490-4492, the current logic is, when there are
modifier keys, including SHIFT, being pressed down, the key code won't be
sent to OS X Input Manager for composing the input method result. This
logic is NOT true for shifted keystrokes. Actually, shifted keystrokes
like ":", "?", "<" or ">" are still display characters and should be sent
into the Input Manager for composing.

      /* if it was a function key or had modifiers, pass it directly to
emacs */
      if (fnKeysym || (emacs_event->modifiers
                       && [[theEvent charactersIgnoringModifiers] length] >
0))

A workable fix:

      /* if it was a function key or had modifiers(except for shift only
modifier), pass it directly to emacs */
      if (fnKeysym || (emacs_event->modifiers
                       && emacs_event->modifiers != shift_modifier
                       && [[theEvent charactersIgnoringModifiers] length] >
0))

Thanks,

-- 
Yong-Gang Wang 王咏刚