emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NS port menus (was: bug#44333: 27.1; macOS menu bar 2-clicks)


From: Alan Third
Subject: NS port menus (was: bug#44333: 27.1; macOS menu bar 2-clicks)
Date: Sun, 27 Dec 2020 18:21:44 +0000

I've moved this to Emacs Devel because that bug report is closed now
and it didn't seem like the right place to discuss it.

On Sun, Dec 27, 2020 at 06:14:25PM +0100, Mattias Engdegård wrote:
> 26 dec. 2020 kl. 22.52 skrev Alan Third <alan@idiocy.org>:
> 
> > It's actually almost possible to copy the Mac port code in verbatim,
> > the NS port's code is based on it after all, but I feel it may be
> > neater to use a custom view for the NSMenuItems. That would give us
> > complete control over the layout.
> 
> We should, but because I was lazy and impatient, I wrote the
> attached (terrible) hack just to see what right-justification would
> look like.
> 
> The right margin is slightly ragged because I'm using plain spaces
> to offset the key binding from the menu text, but I still think it's
> better than what we have now. I tried using U+2009 THIN SPACE and
> even U+200A HAIR SPACE instead but somehow the result became worse;
> no doubt a silly mistake somewhere.

It looks pretty good as is! Slightly off, though, as you say.

I'd wondered about using NSAttributedString and NSParagraphStyle to
set a tab stop at a specific pixel point, that should allow perfect
alignment, or, and this is a bit hackier, display the binding in a
monospace font. Then you could use (variable space font) spaces and
tabs to line up the start of the binding text, then use (monospace
font) spaces to align the bindings. That's maybe a bit too much work,
though, and I'm not at all knowledgeable about how NSAttributedStrings
actually work, so maybe it's impossible.

> I also removed the special hack for s- bindings because it broke the
> nice alignment. If we want, we could translate modifiers into the
> standard symbols (⌘, ⌃, ⇧ and ⌥) depending on these are assigned, or
> just keep using the Emacs notation. We could also translate <right>
> into → and so on.

I think whatever we do it's probably best to be consistent, so losing
the special hack for s- bindings sounds good.

-- 
Alan Third



reply via email to

[Prev in Thread] Current Thread [Next in Thread]