Permalink
Browse files

Make <Shift-Home> work (select entire line with cursor at beginning);…

… make <Delete> work when cursor is at beginning
  • Loading branch information...
1 parent 19747a9 commit 65b9ea306b8f0d4e6de18495b5c50d129397d4a6 @ivan ivan committed Apr 23, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/jvm/bsh/util/JConsole.java
@@ -215,10 +215,14 @@ private synchronized void type(KeyEvent e) {
case (KeyEvent.VK_LEFT):
case (KeyEvent.VK_BACK_SPACE):
- case (KeyEvent.VK_DELETE):
if (text.getCaretPosition() <= cmdStart) {
- // This doesn't work for backspace.
- // See default case for workaround
+ // See also default: case for backspace workaround
+ e.consume();
+ }
+ break;
+
+ case (KeyEvent.VK_DELETE):
+ if (text.getCaretPosition() < cmdStart) {
e.consume();
}
break;
@@ -228,7 +232,11 @@ private synchronized void type(KeyEvent e) {
break;
case (KeyEvent.VK_HOME):
- text.setCaretPosition(cmdStart);
+ if ((e.getModifiers() & InputEvent.SHIFT_MASK) > 0) {
+ text.moveCaretPosition(cmdStart);
+ } else {
+ text.setCaretPosition(cmdStart);
+ }
e.consume();
break;

0 comments on commit 65b9ea3

Please sign in to comment.