This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 77129 - alt keybindings are completly broken on MAC
Summary: alt keybindings are completly broken on MAC
Status: RESOLVED INVALID
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 6.x
Hardware: All Mac OS X
: P2 blocker (vote)
Assignee: Jan Jancura
URL:
Keywords: RELNOTE
: 77127 82511 (view as bug list)
Depends on:
Blocks: 60567 76998
  Show dependency tree
 
Reported: 2006-05-31 09:26 UTC by Pavel Rehak
Modified: 2007-11-05 13:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Messages.log attached (25.54 KB, text/plain)
2006-12-06 09:43 UTC, Jaromir Uhrik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Rehak 2006-05-31 09:26:30 UTC
NetBeans IDE Dev (Build 200605292230)
--
navigation throught the code 
(alt g, alt p, alt o .. ) is broken on MAC,
hitting the keybinding just inserts some internationalized
character

marking as future stopper for q-build QBE200605281800
Comment 1 Jiri Prox 2006-06-08 14:29:25 UTC
*** Issue 77127 has been marked as a duplicate of this issue. ***
Comment 2 Jiri Prox 2006-06-08 14:31:42 UTC
Changing version to 5.0 because of the duplicate issue
Comment 3 _ tboudreau 2006-06-08 18:45:26 UTC
FYI, absolutely no keybindings should be bound to Alt on Macintosh - it is the compose character for 
many international keyboards.  Here is how it should work:

 - Anything that is Ctrl-Something on PC should be Command (META) -Something on mac
 - Anything that is Alt-Something on PC should be Ctrl-something on mac

For declarative keybindings, the logic is already in Utilities.keyToString(), etc. to do this transparently - 
just declare your Ctrl (on PC) keybindings using "D" instead of "C" to indicate Ctrl, and it will 
automagically map to Command on Mac and Ctrl everywhere else.  And similarly, instead of using "A" 
for Alt, use "O" and it will automagically be Ctrl on Macintosh and Command everywhere else.  The 
algorithm in Utilities.keyToString() is smart enough to recognize the few Command- bindings that are 
consumed by Mac OS (Command-H, Command-Q, Command-Space), and not remap those from 
Command to Ctrl.  Example:

CA-R defines a keybinding as Ctrl-Alt-R on all platforms
DO-R defines a keybinding as Ctrl-Alt-R on non-Macintosh, and Command-Ctrl-R on Macintosh.

So this should be relatively simple to fix everywhere.
Comment 4 _ tboudreau 2006-06-13 17:44:06 UTC
Yes, please fix in 5.5.  Whenever you want completion of arguments, you have to insert the character for PI 
into your source code on mac :-/
Comment 5 Miloslav Metelka 2006-06-23 13:48:23 UTC
The keybindings used to be handled through Utilities.keyToString(). I was
supposed that the new options retained this.
Hanzi, please fix this, you are the most eligible person for this ;) Thanks.
Comment 6 Miloslav Metelka 2006-09-12 09:15:54 UTC
*** Issue 82511 has been marked as a duplicate of this issue. ***
Comment 7 _ tboudreau 2006-09-12 10:14:06 UTC
It's getting pretty late to fix this for 5.5 and it makes basic NetBeans
features unusable on the mac.  We should *really* fix this.  Status?
Comment 8 Miloslav Metelka 2006-09-12 15:17:20 UTC
I've checked the NetBeans-keybindings.xml in the editor and also
DefaultKeyBindings.xml in the java/editor and they both seem to contain the
right prefixes e.g. goto-declaration is O-G etc. I've checked both trunk and
release55 and the files are the same.
I've checked with Tomasz Slota on Mac OS X with 5.5 build and the
goto-declaration works with Ctrl-Shift-G. Tim could you please double-check on
your machine and reopen if it's still not working? Thanks.
Comment 9 Jaromir Uhrik 2006-10-18 15:41:11 UTC
NetBeans IDE Dev (Build 200610171800)
1.5.0_06; Java HotSpot(TM) Client VM 1.5.0_06-64
Mac OS X version 10.4.8 running on ppc
en_US (nb); MacRoman

Since 77127 is a duplicate of this issue this one is not fixed. It prints π to
editor instead of offering method parameters when Alt+P is pressed. So what is
the magic keyboard shortcut offering method parameters on Mac OS (ALT+P
equivalent for Mac)?
Comment 10 Jaromir Uhrik 2006-10-18 15:44:16 UTC
Command+Shift+Right and Command+Shift+Left are not working either (or what
shortcut to use instead of it on Mac?).
Comment 11 _ tboudreau 2006-10-19 07:17:18 UTC
If you mean select previous/next word, on Mac OS that *should* be
Alt-Shift-Arrow so that it is consistent with native mac apps (Command
left/right should be the same as home/end on a pc).
Comment 12 Jaromir Uhrik 2006-10-19 10:55:34 UTC
Tim, you are right that Cmd+Left and Cmd+Right move correctly cursor to the
End/Begin of the line. But how can I easily select the line? Sequence Cmd+Left
followed by Cmd+Shift+Right doesn't select the line. This is common behavior
that should work as in other Mac OS tools.
Comment 13 Vitezslav Stejskal 2006-12-04 22:44:35 UTC
I believe that this is now fixed. Please also see issue #60835. I've add a
warning message to the parser of keybinding definitions which alerts modules
when their keybindings are not Mac-friendly.
Comment 14 Jaromir Uhrik 2006-12-06 09:40:59 UTC
This issue seems to be fixed just partially. Hitting alt g, alt p, alt o ..
still writes to editor some internationalized character - there should be added
some default keybinding that is working on Mac. 
The positive for me is that Cmd+Shift+Left/Command+Shift+Right selects line to
the begin/end and works perfectly now.
According to the first part of my comment I am reopening this issue. I am going
to attach the messages.log that shows some warnings related to keymaps.
Comment 15 Jaromir Uhrik 2006-12-06 09:43:46 UTC
Created attachment 36510 [details]
Messages.log attached
Comment 16 Vitezslav Stejskal 2007-01-11 03:59:27 UTC
Jaro, wait a second, of course Alt+something will generate an international
character on Mac. The shortcuts (eg. for tooltip-show action) are defined with
'O-' at the beginning, which means that the platform specific alternate
accelerator will be used. In case of Mac that would be the Ctrl key. So for
showing a tooltip you should press Ctrl+P on Mac and Alt+P on PC. Is this working?

Here is how the shortcuts are defined currently (action:shortcut:keys-Mac:keys-PC):

tooltip-show : O-P : Ctrl+P : Alt+P
goto-source : O-O : Ctrl+O : Alt+O
goto-declaration : OS-G/O-G : Ctrl+Shift+G : Alt+G

The shortcut for the goto-declaration action is different for Mac and PC for
some reason, but should still work. Could you please check that again? Thanks.
Comment 17 _ tboudreau 2007-01-12 10:31:24 UTC
Goto declaration might different because on all Mac OS text editor apps because
Command-G, not Ctrl-H as on windows, is bound to Find Next.   Actually that
shoulnd't be a problem - Ctrl-G would work (but you actually want to hard-bind
that to CTRL on mac so you don't clobber Find Next).

BTW, has anyone checked the new code completion (smart, etc.) shortcuts on Mac?
 If you have multiple locales you switch between, Command-Space switches between
them (why we keep code completion itself as Ctrl-Space even on mac).
Comment 18 Jaromir Uhrik 2007-03-21 15:37:55 UTC
I am marking this issue as VERIFIED. I have checked shortcuts in following build:
NetBeans IDE Dev (Build 200703181900)
1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
Mac OS X version 10.4.8 running on i386
en_US (nb); MacRoman
Comment 19 sangudo 2007-09-19 06:46:49 UTC
This problem still exists with NB6.0 beta 1.

Please fix - it makes emacs keybindings extremely cumbersome on the Mac, whereas they work fine on Linux / Solaris.
Comment 20 Vitezslav Stejskal 2007-09-19 18:41:40 UTC
I am sorry, sangudo, but could you please open a new defect and be more specific about what exactly does not work. This
issue is too confusing to know what needs fixing.
Comment 21 _ tboudreau 2007-09-21 02:55:37 UTC
Well, if there are any keybindings bound to Alt on mac, that is a bug by itself.  Are there any?
Comment 22 Vitezslav Stejskal 2007-09-21 10:10:58 UTC
No, none. Certainly not in the Emacs profile.
less ide/defaults/src/org/netbeans/modules/defaults/Emacs-keybindings.xml
less ide/defaults/src/org/netbeans/modules/defaults/Emacs-keybindings-mac.xml