From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#19977: 24.4; Incorrect translation of Super modifier with Ctrl or Meta on OS X Date: Tue, 29 Mar 2016 20:07:55 +0000 Message-ID: References: <83r3etwc9j.fsf@gnu.org> <83lh51w9z8.fsf@gnu.org> <83d1qdw7bt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11401ab2470bbc052f35961d X-Trace: ger.gmane.org 1459282434 7116 80.91.229.3 (29 Mar 2016 20:13:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Mar 2016 20:13:54 +0000 (UTC) Cc: 19977@debbugs.gnu.org To: Adrian Robert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 29 22:13:39 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1akzwu-0002N7-G9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Mar 2016 22:09:12 +0200 Original-Received: from localhost ([::1]:49734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akzwt-00019o-3a for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Mar 2016 16:09:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akzwo-00019c-3u for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2016 16:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akzwk-0005mW-Kh for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2016 16:09:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akzwk-0005mP-Go for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2016 16:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1akzwk-0001RE-Ai for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2016 16:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Mar 2016 20:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19977 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19977-submit@debbugs.gnu.org id=B19977.14592820925469 (code B ref 19977); Tue, 29 Mar 2016 20:09:02 +0000 Original-Received: (at 19977) by debbugs.gnu.org; 29 Mar 2016 20:08:12 +0000 Original-Received: from localhost ([127.0.0.1]:44144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akzvv-0001Q8-Kd for submit@debbugs.gnu.org; Tue, 29 Mar 2016 16:08:11 -0400 Original-Received: from mail-lf0-f54.google.com ([209.85.215.54]:36138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akzvu-0001Pv-C1 for 19977@debbugs.gnu.org; Tue, 29 Mar 2016 16:08:10 -0400 Original-Received: by mail-lf0-f54.google.com with SMTP id e133so20718921lfe.3 for <19977@debbugs.gnu.org>; Tue, 29 Mar 2016 13:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jOCin+yPcWNUJj8jYovYfc8wOxRhTNR4ILAjVTjAXeE=; b=dueSnZiwbmyQqQHZKgEMfODdDJw9jZJcyWGz2u/PlxM3E1G968fTl2iragNMIIppXu yDaIMUD5l90mjsBodnJDCBazn3Ik6WXdCg0ojVyY5iLE3xhYd11mTEC+xGScd3DLo1dR u/TMe3pL86kjj3/EqJ+84PHV3pxfJS2QBjQy5jqH2HKNNmR9Y/IGHLqv3aArTtIJNkh3 puoyobk76H+FIRApGz/KSTRyNM843eJ21fjhtNpUEA0k9da9BKamIj0hYphzAvgamcCy 0UQTTHpHeaezFCngHqyh/ugB74EOyadVKZ2R2NSbBg+kPyRpEX+r4U1HoM707bqmjs2s 8pVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jOCin+yPcWNUJj8jYovYfc8wOxRhTNR4ILAjVTjAXeE=; b=XutzTg2rsSh6v8QxR+6B8CAQnc/mNN4TZqvvf8PHNsW7gm9Y1ajU+Znn+jGoR29eg+ OMYAVw7C5i+i3ry3TpEg1K16m5NZuGS4K2sqNGOcU52UovaxDmKXQ8gbBap5GsPOSfU9 0WdiF+Cr3VVCbXnYe4ttfCSxmDesrO09nHrCuRGdsTHHhSR+OXcU6QJ9Ub8lObejsyXj No7eOz8U8n0W9Aqvkvyahg1Yf5aLJfy1x2nwXVNJufmyLwM7kAH9zawO1sA5rn9s06qq YrrCPIApaCU8wEaFQmTZYkBDw5GyPQcN1zwoByw9DijuuTPPiGgOb7nV0lRjxDXcOUGv U4iQ== X-Gm-Message-State: AD7BkJLwSlqtAiFNK2HkxVK8nmvCfJL1o6oT86FjRMJALe5IJkVAA9fNvzIXZ+UYogJQEGCEbtZIcAd56hu2TQ== X-Received: by 10.25.146.206 with SMTP id u197mr1985657lfd.139.1459282084562; Tue, 29 Mar 2016 13:08:04 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:115736 Archived-At: --001a11401ab2470bbc052f35961d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Philipp Stephani schrieb am Di., 29. M=C3=A4rz 2016= um 21:43 Uhr: > Adrian Robert schrieb am Di., 29. M=C3=A4rz 2= 016 > um 19:56 Uhr: > >> >> On 2016.3.29, at 20:44, Philipp Stephani wrote: >> >> > >> > >> > Adrian Robert schrieb am Di., 29. M=C3=A4r= z >> 2016 um 19:19 Uhr: >> > >> > On 2016.3.29, at 19:57, Eli Zaretskii wrote: >> > >> > >> From: Philipp Stephani >> > >> Date: Tue, 29 Mar 2016 16:38:52 +0000 >> > >> Cc: 19977@debbugs.gnu.org >> > >> >> > >> If I comment out the if block below the comment >> > >> >> > >> /* if super (default), take input manager's word so things like >> > >> dvorak / qwerty layout work */ >> > >> >> > >> in nsterm.m, everything works. Unless somebody can explain why that >> if block exists at all (i.e. why >> > >> [theEvent characters] instead of [theEvent >> charactersIgnoringModifiers] is used), then I'd suggest to >> > >> remove the block completely. >> > >> >> > >> Attached a patch to remove this code. >> > > >> > > Adrian, any comments? It's your code from 7 years ago. >> > >> > >> > Heh, well of the top of my head=E2=80=A6 ;-) >> > >> > Did you try testing Dvorak / Qwerty layout? If not, that=E2=80=99s un= der >> System Preferences, Keyboard, add new, English, select Dvorak or Dvorak = / >> Qwerty. >> > >> > From what I remember, the issue had to do with cmd-key shortcuts when >> one of those layouts was in use. I think users were expecting the lette= r >> reported for the cmd shortcut to either agree with or disagree with the >> dvorak layout. Using [theEvent characters] caused it to use what they w= ere >> expecting. >> > >> > It sounds like either this wasn=E2=80=99t the right solution, or user >> expectations vary. In either case I would agree with simplifying the co= de >> and removing the part you suggest. >> > >> > >> > Yes, I can see what the problem is, thanks for the pointer. Basically >> in a couple of layouts (there are others, e.g. "Gujarati - QUERTY"), >> Command acts as shift-like character, like Option and Shift, selecting a >> different character, and not as a control-like character. For Option, Em= acs >> allows switching between shift-like and control-like behavior using the >> `ns-alternate-modifier' option. The same should be implemented for Comma= nd. >> > However, the code for `ns-alternate-modifier' is also somewhat broken. >> If it's set to 'none, C-M- doesn't work any more. This needs a b= it >> more thought. What exactly is supposed to happen if both a shift-like an= d a >> control-like modifier are pressed at the same time? Emacs is inconsisten= t >> here: C-S-a remains C-S-a, but M-S-a gets translated to M-A. >> >> >> I would say the correct behavior is to combine the modifier and the >> =E2=80=9Cshift=E2=80=9Ded result. C-S-a should be C-A. But my memory i= s fuzzy as to >> whether nsterm should do this or it happens in emacs generic code. And = if >> ns-alternate-modifier is =E2=80=98none=E2=80=99, then there is no such t= hing as C-M-letter, >> just C-letter, where the identify of =E2=80=98letter' is determined by w= hat comes >> from opt-. >> >> >> >> >> > I agree that this behavior is the desired/expected one. Unfortunately it > seems the NSEvent API makes this somewhat hard to implement: you can eith= er > ignore all modifiers except shift (using charactersIgnoringModifiers) or > none (using characters), but we'd need to ignore a certain subset of the > modifiers. > It seems that this behavior cannot be implemented without resorting to UCKeyTranslate. Therefore I'd suggest to fall back to the next best option and ignore all shift-like modifiers if control-like modifiers are present, similar to what we're doing with C-S on Unix terminals. --001a11401ab2470bbc052f35961d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Philip= p Stephani <p.stephani2@gmail.c= om> schrieb am Di., 29. M=C3=A4rz 2016 um 21:43=C2=A0Uhr:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">
<= div dir=3D"ltr">Adrian Robert <adrian.b.robert@gmail.com> schrieb am Di., 29.= M=C3=A4rz 2016 um 19:56=C2=A0Uhr:
=
On 2016.3.29, at 20:44, Philipp Stephani <p.stephani2@gmail.com> wrote:

>
>
> Adrian Robert <adrian.b.robert@gmail.com> schrieb am Di., 29. M=C3=A4rz= 2016 um 19:19 Uhr:
>
> On 2016.3.29, at 19:57, Eli Zaretskii <eliz@gnu.org> wrote:
>
> >> From: Philipp Stephani <p.stephani2@gmail.com>
> >> Date: Tue, 29 Mar 2016 16:38:52 +0000
> >> Cc: 19977@debbugs.gnu.org
> >>
> >> If I comment out the if block below the comment
> >>
> >> /* if super (default), take input manager's word so thing= s like
> >> dvorak / qwerty layout work */
> >>
> >> in nsterm.m, everything works. Unless somebody can explain wh= y that if block exists at all (i.e. why
> >> [theEvent characters] instead of [theEvent charactersIgnoring= Modifiers] is used), then I'd suggest to
> >> remove the block completely.
> >>
> >> Attached a patch to remove this code.
> >
> > Adrian, any comments?=C2=A0 It's your code from 7 years ago.<= br> >
>
> Heh, well of the top of my head=E2=80=A6 ;-)
>
> Did you try testing Dvorak / Qwerty layout?=C2=A0 If not, that=E2=80= =99s under System Preferences, Keyboard, add new, English, select Dvorak or= Dvorak / Qwerty.
>
> From what I remember, the issue had to do with cmd-key shortcuts when = one of those layouts was in use.=C2=A0 I think users were expecting the let= ter reported for the cmd shortcut to either agree with or disagree with the= dvorak layout.=C2=A0 Using [theEvent characters] caused it to use what the= y were expecting.
>
> It sounds like either this wasn=E2=80=99t the right solution, or user = expectations vary.=C2=A0 In either case I would agree with simplifying the = code and removing the part you suggest.
>
>
> Yes, I can see what the problem is, thanks for the pointer. Basically = in a couple of layouts (there are others, e.g. "Gujarati - QUERTY"= ;), Command acts as shift-like character, like Option and Shift, selecting = a different character, and not as a control-like character. For Option, Ema= cs allows switching between shift-like and control-like behavior using the = `ns-alternate-modifier' option. The same should be implemented for Comm= and.
> However, the code for `ns-alternate-modifier' is also somewhat bro= ken. If it's set to 'none, C-M-<letter> doesn't work any = more. This needs a bit more thought. What exactly is supposed to happen if = both a shift-like and a control-like modifier are pressed at the same time?= Emacs is inconsistent here: C-S-a remains C-S-a, but M-S-a gets translated= to M-A.


I would say the correct behavior is to combine the modifier and the =E2=80= =9Cshift=E2=80=9Ded result.=C2=A0 C-S-a should be C-A.=C2=A0 But my memory = is fuzzy as to whether nsterm should do this or it happens in emacs generic= code.=C2=A0 And if ns-alternate-modifier is =E2=80=98none=E2=80=99, then t= here is no such thing as C-M-letter, just C-letter, where the identify of = =E2=80=98letter' is determined by what comes from opt-<original-key&= gt;.





I agree that this behavior is the desired/expected one. U= nfortunately it seems the NSEvent API makes this somewhat hard to implement= : you can either ignore all modifiers except shift (using charactersIgnorin= gModifiers) or none (using characters), but we'd need to ignore a certa= in subset of the modifiers.

It seems that this behavior cannot be implemented without resorting to U= CKeyTranslate. Therefore I'd suggest to fall back to the next best opti= on and ignore all shift-like modifiers if control-like modifiers are presen= t, similar to what we're doing with C-S on Unix terminals.=C2=A0
<= /div> --001a11401ab2470bbc052f35961d--