Permalink
Browse files

Fix C-h bug, and add C-t

  • Loading branch information...
1 parent d2b31b8 commit 91e3bce96a0eaf2d9a34ab7883788639cef27ab0 @jondistad committed Mar 31, 2012
Showing with 27 additions and 1 deletion.
  1. +27 −1 javascripts/tty.js
View
@@ -95,7 +95,9 @@
switch (e.which) {
// Backward delete
case 72: // H
- if (! e.ctrlKey) break;
+ if (e.ctrlKey)
+ deleteBack();
+ break;
case 8: // Backspace
if (e.ctrlKey || e.altKey)
deleteBackWord();
@@ -160,6 +162,12 @@
case 34: // End
moveToEnd();
break;
+
+ // Swap chars
+ case 84: // T
+ if (e.ctrlKey)
+ swapChars();
+ break;
}
});
}
@@ -265,6 +273,24 @@
TTY.afterCursor.html('');
}
+ function swapChars() {
+ debugger;
+ if (TTY.command.text()) {
+ moveRight();
+ } else if (TTY.afterCursor.text()) {
+ moveRight();
+ moveRight();
+ }
+ var command = TTY.command.text();
+ var formerChar = command[command.length-2];
+ var latterChar = command[command.length-1];
+
+ var newCommand = command.substr(0, command.length-2);
+ if (latterChar) newCommand += latterChar;
+ if (formerChar) newCommand += formerChar;
+ TTY.command.html(escapeHTML(newCommand));
+ }
+
function consumeLine() {
var output = TTY.readerFn(TTY.inputBuffer + TTY.command.text());
if (output === false) {

0 comments on commit 91e3bce

Please sign in to comment.