Skip to content

Commit 02914d7

Browse files
nopdotcomcmaglie
authored andcommitted
Add more of OS X's native Emacs keybindings
OS X supports many simple Emacs keybindings in native text fields. (It can do this because the system UI uses Cmd instead of Ctrl as its main modifier key.) Add bindings to functions which already exist in DefaultEditorKit. I have a Ctrl-k (cut to end of line) implementation, but it is an additional static RecordableTextAction class. I have not included it.
1 parent 050e8ba commit 02914d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: app/src/processing/app/syntax/SketchTextAreaDefaultInputMap.java

+8
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,16 @@ public SketchTextAreaDefaultInputMap() {
6767

6868
put(KeyStroke.getKeyStroke(KeyEvent.VK_A, ctrl), DefaultEditorKit.beginLineAction);
6969
put(KeyStroke.getKeyStroke(KeyEvent.VK_E, ctrl), DefaultEditorKit.endLineAction);
70+
put(KeyStroke.getKeyStroke(KeyEvent.VK_N, ctrl), DefaultEditorKit.downAction);
71+
put(KeyStroke.getKeyStroke(KeyEvent.VK_P, ctrl), DefaultEditorKit.upAction);
72+
put(KeyStroke.getKeyStroke(KeyEvent.VK_B, ctrl), DefaultEditorKit.backwardAction);
73+
put(KeyStroke.getKeyStroke(KeyEvent.VK_F, ctrl), DefaultEditorKit.forwardAction);
74+
put(KeyStroke.getKeyStroke(KeyEvent.VK_D, ctrl), DefaultEditorKit.deleteNextCharAction);
75+
put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, ctrl), DefaultEditorKit.pasteAction);
76+
put(KeyStroke.getKeyStroke(KeyEvent.VK_W, ctrl), DefaultEditorKit.cutAction);
7077
}
7178

79+
// VK_DIVIDE is the keypad; should this be added to VK_SLASH as well?
7280
put(KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, defaultModifier), RSyntaxTextAreaEditorKit.rstaToggleCommentAction);
7381

7482
put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0), DefaultEditorKit.backwardAction);

0 commit comments

Comments
 (0)