nordfalk / jsyntaxpane

An updated version of code.google.com/p/jsyntaxpane r096 branch
36 stars 22 forks source link

Mac OS X (modifier) keys #151

Closed GoogleCodeExporter closed 7 years ago

GoogleCodeExporter commented 9 years ago
Most keyboard actions should use the default platform's menu modifier, which on 
OS X is command (META) and not control. Also it should use the standard 
platform letter. E.g.

Undo:
currently is Ctrl+Z
should be Cmd+Z

Reso:
currently is Ctrl+Y
should be Cmd+Shift+Z

Find:
currently is Ctrl+H
should be Cmd+F

Find-Next:
currently is F3
should be Cmd+G

Cut/ Copy/ Paste work as expected because of the underlying editor kit i guess.

Original issue reported on code.google.com by annablum...@googlemail.com on 30 Jun 2010 at 12:26

GoogleCodeExporter commented 9 years ago
It could check for the OS when adding the accelerators, as described in

http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Devel
opment/07-NativePlatformIntegration/NativePlatformIntegration.html

Original comment by cde...@gmail.com on 1 Jul 2010 at 5:54

GoogleCodeExporter commented 9 years ago
The "standard" cut/copy/paste keys are not mapped by jsyntaxpane, so the 
built-in actions and their key mappings are used.
All other actions are jsyntaxpane actions which I need to map to keys.  The 
problem is that it will be a big task to map the keys according to the 
platform.  Or you'll need to create new config.properties file for the 
different platforms and then jsyntaxpane would use the one based on the 
platform.  This is now beyond what I can do with my limited time on this.  If 
you are welling to help, let me know and I can give you a basic design that 
will fit the rest of the project.

Original comment by ayman.al...@gmail.com on 7 Jul 2010 at 1:37

GoogleCodeExporter commented 9 years ago
Since 0.95_b29 it's now possible to use a special modifier "menu".

The DefaultSyntaxKit maps it to the Systems Menu-Key.

Unfortunatly there's still support for OSX missing. It only checks for the 
"alt"-Key.

Propably it should look like this:

        static {
                // we only need to initialize once.
                if (!initialized) {
                        initKit();
                }
                int menuMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
                if(menuMask == KeyEvent.ALT_DOWN_MASK) {
                        MENU_MASK_STRING = "alt ";
                }
                if(menuMask == KeyEvent.META_MASK) {
                  MENU_MASK_STRING = "meta ";
                }
        }

Original comment by roger.to...@gmail.com on 17 Feb 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Yep, I can confirm if you add to the DefaultSyntaxKit static initializer:
if(menuMask == KeyEvent.META_MASK) {
    MENU_MASK_STRING = "meta ";
}
and changing the config.properties to use "menu" instead of "ctrl" for the 
shortcuts fixes it for Mac OS X

Original comment by Gabriel....@gmail.com on 5 Mar 2012 at 7:50