Skip to content

Commit

Permalink
reverted key bindings (AlloyTools#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmacedo committed Oct 16, 2024
1 parent f861715 commit 28cbf9e
Showing 1 changed file with 1 addition and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,52 +157,7 @@ public void keyPressed(KeyEvent e) {
module = null;
}
});
int modifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
this.pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifier), "line.begin");
this.pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifier + InputEvent.SHIFT_DOWN_MASK), "line.begin");
this.pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, modifier), "line.end");
this.pane.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, modifier + InputEvent.SHIFT_DOWN_MASK), "line.end");

this.pane.getActionMap().put("line.begin", new AbstractAction() {

@Override
public void actionPerformed(ActionEvent e) {
try {
int caretPosition = pane.getSelectionEnd();
int startOfLine = Utilities.getRowStart(pane, caretPosition);
if (isShifted(e)) {

pane.setSelectionEnd(caretPosition);
pane.setSelectionStart(startOfLine);
} else {
pane.setCaretPosition(startOfLine);
}
} catch (Exception ee) {
// ignore
}
}

});

this.pane.getActionMap().put("line.end", new AbstractAction() {

@Override
public void actionPerformed(ActionEvent e) {
try {
int caretPosition = pane.getSelectionStart();
int endOfLine = Utilities.getRowEnd(pane, caretPosition);
if (isShifted(e)) {

pane.setSelectionEnd(endOfLine);
pane.setSelectionStart(caretPosition);
} else {
pane.setCaretPosition(endOfLine);
}
} catch (Exception ee) {
// ignore
}
}
});

this.parent = parent;
this.obj1 = obj1;
this.obj2 = obj2;
Expand Down

0 comments on commit 28cbf9e

Please sign in to comment.