Skip to content

Commit

Permalink
Add support for delete key in command line mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
keforbes committed May 30, 2012
1 parent f9a8759 commit b5004ec
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public abstract class AbstractCommandParser {
protected static final KeyStroke KEY_ESCAPE = key(SpecialKey.ESC);
protected static final KeyStroke KEY_CTRL_C = ctrlKey('c');
protected static final KeyStroke KEY_BACKSP = key(SpecialKey.BACKSPACE);
protected static final KeyStroke KEY_DELETE = key(SpecialKey.DELETE);
protected static final KeyStroke KEY_CTRL_V = key((char) 22);
protected static final KeyStroke KEY_UP = key(SpecialKey.ARROW_UP);
protected static final KeyStroke KEY_DOWN = key(SpecialKey.ARROW_DOWN);
Expand Down Expand Up @@ -59,12 +60,17 @@ public void type(KeyStroke e) {
position--;
modified = true;
}
// TODO: on Mac OS, Cmd-V should be used
} else if (e.equals(KEY_DELETE)) {
if (position < buffer.length()) {
buffer.replace(position, position+1, "");
modified = true;
}
} else if (e.equals(KEY_CTRL_V)) {
String text = editor.getRegisterManager().getRegister(
RegisterManager.REGISTER_NAME_CLIPBOARD).getContent().getText();
text = text.replace('\n', ' ').replace('\r', ' ');
buffer.append(text);
// TODO: on Mac OS, Cmd-V should be used
} else if (e.equals(KEY_UP)) {
if (modified)
history.setTemp(getCommand());
Expand Down

0 comments on commit b5004ec

Please sign in to comment.