some cool changes for the key-hit-system

This commit is contained in:
overflowerror 2014-05-24 00:57:19 +02:00
parent 01b35fb504
commit be0e09e01b
2 changed files with 13 additions and 2 deletions

View file

@ -84,7 +84,7 @@ Emulator.handleKeyPress = function(e) {
}
Emulator.handleKeyDown = function(e) {
var keycode = Emulator.getKeyCode(e);
if (keycode == 8 || keycode == 46) {
if (KeyCodes.isSpecialKey(keycode)) {
Emulator.handleKeyPress(e);
return false;
}
@ -177,7 +177,7 @@ Emulator.ANSISequences.output = function(text) {
Emulator.Output.cursorOff();
Emulator.Output.moveCursor(0, - parseInt(specialText), false);
Emulator.Output.cursorOn();
normalText = "";
normalText = "";
specialText = "";
specialText2 = "";
state = 0;

View file

@ -3,6 +3,17 @@ var KeyCodes = function() {
KeyCodes.normalKey = function(code) {
return String.fromCharCode(code);
}
KeyCodes.isSpecialKey = function(code) {
return (code == 8) ||
(code == 10) ||
(code == 13) ||
(code == 27) ||
(code == 37) ||
(code == 38) ||
(code == 39) ||
(code == 40) ||
(code == 46);
}
KeyCodes.isBackspace = function(code) {
return (code == 8);
}