all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 29595@debbugs.gnu.org, Paul Rankin <hello@paulwrankin.com>
Subject: bug#29595: 26.0.90; menu items show incorrect shortcut keys
Date: Fri, 22 Dec 2017 12:34:33 +0000	[thread overview]
Message-ID: <20171222123433.GA36334@breton.holly.idiocy.org> (raw)
In-Reply-To: <83o9mrmdet.fsf@gnu.org>

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

On Fri, Dec 22, 2017 at 09:26:18AM +0200, Eli Zaretskii wrote:
> > From: Paul Rankin <hello@paulwrankin.com>
> > Date: Fri, 22 Dec 2017 15:16:32 +1000
> > 
> > I’ve now tested this with Emacs versions 24.4, 25.4, 26.0.90 and HEAD
> > with the same results; this hasn’t happened for me with 24.x in the
> > past, so it appears that something has changed with macOS High Sierra
> > that screws up the display of shortcut keys in the menus.
> 
> You are probably right.

It seems that older macOS versions ignored keyboard shortcuts they
didn’t understand, but High Sierra appears to use a ‘best effort’
attempt which results in it just printing out the first character
(capital C for ctrl, so shift‐C).

I’ve attached a patch that I hope fixes it.

-- 
Alan Third

[-- Attachment #2: 0001-Fix-menu-keyboard-shortcuts-on-macOS-Bug-29595.patch --]
[-- Type: text/plain, Size: 1760 bytes --]

From 3ca7f2e2113eeace6b75f5f4b86bbcc4be609807 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Fri, 22 Dec 2017 12:27:05 +0000
Subject: [PATCH] Fix menu keyboard shortcuts on macOS (Bug#29595)

* src/nsmenu.m (addItemWithWidgetValue)[NS_IMPL_COCOA]: It looks like
macOS 10.13 no longer ignores long modifier strings, so explicitly use
an empty string.
---
 src/nsmenu.m | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 6ef7b60dc2..d2e102a2a9 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -643,14 +643,23 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
 
       keyEq = [self parseKeyEquiv: wv->key];
 #ifdef NS_IMPL_COCOA
-      /* macOS just ignores modifier strings longer than one character */
+      /* macOS mangles modifier strings longer than one character.  */
       if (keyEquivModMask == 0)
-        title = [title stringByAppendingFormat: @" (%@)", keyEq];
+        {
+          title = [title stringByAppendingFormat: @" (%@)", keyEq];
+          item = [self addItemWithTitle: (NSString *)title
+                                 action: @selector (menuDown:)
+                          keyEquivalent: @""];
+        }
+      else
+        {
+#endif
+          item = [self addItemWithTitle: (NSString *)title
+                                 action: @selector (menuDown:)
+                          keyEquivalent: keyEq];
+#ifdef NS_IMPL_COCOA
+        }
 #endif
-
-      item = [self addItemWithTitle: (NSString *)title
-                             action: @selector (menuDown:)
-                      keyEquivalent: keyEq];
       [item setKeyEquivalentModifierMask: keyEquivModMask];
 
       [item setEnabled: wv->enabled];
-- 
2.14.3


  reply	other threads:[~2017-12-22 12:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07  1:35 bug#29595: 26.0.90; menu items show incorrect shortcut keys Paul Rankin
2017-12-07 21:40 ` Alan Third
2017-12-22  5:16 ` Paul Rankin
2017-12-22  7:26   ` Eli Zaretskii
2017-12-22 12:34     ` Alan Third [this message]
2017-12-22 13:09       ` Eli Zaretskii
2017-12-22 15:50         ` Alan Third
2017-12-31  4:03           ` Paul Rankin
2017-12-31 11:40             ` Alan Third
2018-01-01 10:40               ` Paul Rankin
2018-01-01 13:47                 ` Alan Third

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=20171222123433.GA36334@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=29595@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=hello@paulwrankin.com \
    /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.