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 228315

Summary: the "duplicate lines up/down" shortcuts conflict with OS-wide shortcuts on OS X
Product: editor Reporter: athompson <athompson>
Component: Key bindingsAssignee: Svata Dedic <sdedic>
Status: VERIFIED FIXED    
Severity: normal CC: psomol, tstupka
Priority: P3 Keywords: USABILITY
Version: 7.4   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: OS X Shortcuts
OS X Shortcuts

Description athompson 2013-04-05 22:51:24 UTC
The "duplicate lines up/down" shortcuts are mapped to SHIFT-COMMAND-UP/DOWN on OS X. COMMAND-UP/DOWN and SHIFT-COMMAND-UP/DOWN are standard/reserved OS X shortcuts for navigating to the top/bottom of a document. This leads to very unexpected (and destructive behavior).
Comment 1 athompson 2013-04-10 22:12:45 UTC
Additional issues: On OS X the HOME/END/PAGE_UP/PAGE_DOWN commands move the view but *not* the cursor position (similar to clicking on the scroll bar), so they aren't appropriate shortcuts for Netbeans. The correct shortcuts to handle these tasks should be added (keeping the current incorrect shortcuts as alternatives to avoid confusing newbies):

Insertion Point to Beginning of Document: META+UP
Insertion Point to End of Document: META+DOWN
Extend Selection to Beginning of Document: SHIFT+META+UP
Extend Selection to End of Document: SHIFT+META+DOWN
Page Up: ALT+PAGE_UP
Page Down: ALT+PAGE_DOWN
Extend Selection to Previous Page: SHIFT+ALT+PAGE_UP
Extend Selection to Next Page: SHIFT+ALT+PAGE_DOWN

And suggestions for the commands from the description (the original shortcuts should be removed):

Duplicate Line(s) Up: ALT+META+UP
Duplicate Line(s) Up: ALT+META+DOWN
Comment 2 athompson 2013-04-10 22:13:55 UTC
META = COMMAND
Comment 3 athompson 2013-04-10 22:40:26 UTC
Whoops--the first two in the list are already correct.
Comment 4 Svata Dedic 2013-04-19 12:15:25 UTC
Strangely neither Eclipse or IntelliJ seem to bother to conform to Mac nonstandard keyboard mappings (even though IntelliJ has a special MacOS 10.5+ key map)
Comment 5 athompson 2013-04-19 16:04:52 UTC
I imagine it's because they're not mac users, and most people can't seem to overcome the confusion generated by having keys with the same name doing something completely different (home/end), and the concept that keyboard shortcuts don't necessarily have to affect cursor position.

These are all *standard* OSX mappings.
Comment 6 Svata Dedic 2013-04-22 06:50:33 UTC
Although the mappings may be OS-X standard, the are not standard in the target software segment; at least 3 major players (NB, IntelliJ, Eclipse) do not conform to Apple scheme, possibly for a good reason.

Since the request seems to remap core keys used consistently in code editing application on various OSes (excluding MacOS, which is special) it should be reviewed for potential usability issues. 
We cannot blindly conform to whatever scheme if the impact on the current or prospective users would be negative in terms of either productivity or expected behaviour.

BTW - even if the request will be rejected (which I do not know at this point) you are free to contribute a plugin that rebinds the editor movement keys exactly according to Apple standards.

Reassigning for usability impact evaluation.
Comment 7 athompson 2013-04-22 13:32:37 UTC
As I mentioned, you can (and should) keep the current key combinations as alternatives, so there shouldn't be any usability issues. However, as mentioned in the description COMMAND-SHIFT-UP/DOWN are *the* OS X shortcuts for navigating to the top/bottom of a file (with selection). Something so basic and common should not be mapped to something else in Netbeans, and certainly not to something destructive.

As for the "what the other IDEs do argument", I use Eclipse and IntelliJ. Eclipse does this key combination properly, and as any mac user can tell you IntelliJ's OS X keymaps are a joke. In neither case is it mapped to anything other than for navigation.
Comment 8 athompson 2013-04-22 13:35:17 UTC
And seriously, since when is "the other guys do it wrong, so we should do it wrong too" a valid argument?
Comment 9 Svata Dedic 2013-04-22 13:52:59 UTC
The goal is to make the IDE more usable. Not only for native MacOS X application users, but also for 'immigrants' from other IDEs, and for people who develop on multiple platforms and not necessarily use Mac as their primary OS.

As I am not that skilled in balancing those criteria, so I've asked for expertise. I suggest to wait for the outcome; although having collected a list of supporting arguments from one of the affected user groups is a plus.
Comment 10 athompson 2013-04-22 14:42:09 UTC
Isn't there a separate keymap for OS X (rhetorical question--the answer is "yes")? Adding the correct keys for OS X won't affect anyone else.

And once again, I agree--that's why the current mappings should be kept as alternatives. I'm using the terminology used in the IDE itself--"alternative" means alternate key mapping. That is, the current key combinations will still work in addition to the new ones. The only exception is the one first mentioned in this report, which is a recent addition and already isn't where people who use different platforms would expect to find it, since obviously other platforms don't have a COMMAND key.
Comment 11 Svata Dedic 2013-04-24 12:09:19 UTC
Just to be sure: what is 'home' on the apple keyboard ? I borrowed MacBook Pro, and the closest to 'Home' key (which does not exist) is Fn+LEFT, Fn+RIGHT for 'End' - but their function in XCode or TextEdit is a way different (scroll view one page up/down). Actually I can't find a key for 'start of the line' function :)

Could you list, preferrably in a table, bindings for [all] navigational actions, according to Mac standards ? I need to find clashes of mac-native shortcuts with other actions and possibly remap the affected actions to different shortcuts for MacOS X.
Comment 12 athompson 2013-04-24 16:07:16 UTC
Yep, FN-LEFT/RIGHT is the HOME/END equivalent (that is, Apple's version of these keys).  Actually, the HOME/END keys scroll the *view but not the cursor* to the top/bottom of the document, as if you dragged the scroll bar widget to the top/bottom. PAGE UP/PAGE DOWN works similarly except they move the view one page at a time. Since on OSX these commands don't move the cursor, they're not technically the right commands Netbeans should be using (AFAIK Netbeans does not have an equivalent command for them). You're right that these keys should be kept in the default profile to make things easier on those more familiar with the Windows/Unix/Everyone Else way. Just add the technically correct keys as well. The more rabid OSX purists will complain that they don't want their environment polluted with Windows cruft, so maybe make a new "OSX Purist" profile as well.
Comment 13 athompson 2013-04-24 19:13:34 UTC
Created attachment 133775 [details]
OS X Shortcuts
Comment 14 athompson 2013-04-24 19:18:09 UTC
Created attachment 133776 [details]
OS X Shortcuts
Comment 15 Svata Dedic 2013-05-09 12:57:12 UTC
As you noted, I cannot find relevant action for only scrolling except 
"scroll [line] up/down", but those are not defined on the mac on the other hand.

I added META-Left/Right, moved 'duplicate lines' to ALT-SHIFT-up/down, restoring original OSX behaviour for Shift-META-up/down.

Fixed in http://hg.netbeans.org/jet-main/rev/60679413638f
Comment 16 Quality Engineering 2013-05-11 02:32:49 UTC
Integrated into 'main-golden', will be available in build *201305102300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/60679413638f
User: Svata Dedic <sdedic@netbeans.org>
Log: #228315: remapped conflicting shortcuts
Comment 17 athompson 2013-05-22 17:44:21 UTC
Works fine, thanks! But sorry, I overlooked a couple of other issues. Do you want me to verify this issue and create a new one, leave this one as resolved pending those issues, or reopen?

Anyway:

Control-up/down/left/right and shift-control-up/down are also OS X reserved shortcuts dealing with workspace management. This affects:

  - scroll up/down (control-up/down)
  - back/forward (ctrl-left/right)--does this work on Windows either since that's next/previous word?

This shortcut has a conflict but it works since it has an alternate. However, the alternate (option-up/down) technically conflicts with the OS X shortcut for paragraph up/down (which I failed to put on that shortcut list--sorry):

  - navigate to previous/next occurrence (also control-up/down)
Comment 18 athompson 2013-07-04 15:25:11 UTC
Should I verify this and open a new bug for the conflicts mentioned in comment #17, or just keep this one open?
Comment 19 Petr Somol 2013-07-08 08:26:45 UTC
(In reply to comment #18)
> Should I verify this and open a new bug for the conflicts mentioned in comment
> #17, or just keep this one open?

I would recommend to create a new bugzilla issue(s) for the remaining problems (while keeping all related issues linked through dependencies), not to over-complicate this particular one. It is better to keep issues focused as narrowly as possible and not to change their scope during commenting discussion - that makes later orientation more difficult and may prevent new users from discovering that a particular problem has already been filed. Thanks, Peter
Comment 20 Svata Dedic 2013-07-16 06:30:35 UTC
*** Bug 230029 has been marked as a duplicate of this bug. ***
Comment 21 athompson 2013-08-18 11:03:17 UTC
yup