Changes to support APL characters

This commit is contained in:
Blake McBride 2016-05-13 19:15:15 -05:00
parent 628d41f32c
commit 863a8d91c7

View file

@ -2914,9 +2914,9 @@ VT100.prototype.fixEvent = function(event) {
// Some browsers fail to translate keys, if both shift and alt/meta is // Some browsers fail to translate keys, if both shift and alt/meta is
// pressed at the same time. We try to translate those cases, but that // pressed at the same time. We try to translate those cases, but that
// only works for US keyboard layouts. // only works for US keyboard layouts.
var u = undefined;
var s = undefined;
if (event.shiftKey) { if (event.shiftKey) {
var u = undefined;
var s = undefined;
switch (this.lastNormalKeyDownEvent.keyCode) { switch (this.lastNormalKeyDownEvent.keyCode) {
case 39: /* ' -> " */ u = 39; s = 34; break; case 39: /* ' -> " */ u = 39; s = 34; break;
case 44: /* , -> < */ u = 44; s = 60; break; case 44: /* , -> < */ u = 44; s = 60; break;
@ -2957,17 +2957,23 @@ VT100.prototype.fixEvent = function(event) {
case 222: /* ' -> " */ u = 39; s = 34; break; case 222: /* ' -> " */ u = 39; s = 34; break;
default: break; default: break;
} }
if (s && (event.charCode == u || event.charCode == 0)) { } else {
var fake = [ ]; var c = this.lastNormalKeyDownEvent.keyCode;
fake.charCode = s; if (c >= 65 && c <= 90) {
fake.keyCode = event.keyCode; u = c;
fake.ctrlKey = event.ctrlKey; s = u | 32;
fake.shiftKey = event.shiftKey;
fake.altKey = event.altKey;
fake.metaKey = event.metaKey;
return fake;
} }
} }
if (s && (event.charCode == u || event.charCode == 0)) {
var fake = [ ];
fake.charCode = s;
fake.keyCode = event.keyCode;
fake.ctrlKey = event.ctrlKey;
fake.shiftKey = event.shiftKey;
fake.altKey = event.altKey;
fake.metaKey = event.metaKey;
return fake;
}
return event; return event;
}; };
@ -3052,10 +3058,8 @@ VT100.prototype.keyDown = function(event) {
} else { } else {
fake.charCode = 0; fake.charCode = 0;
fake.keyCode = event.keyCode; fake.keyCode = event.keyCode;
if (!alphNumKey && event.shiftKey) {
fake = this.fixEvent(fake);
}
} }
fake = this.fixEvent(fake);
this.handleKey(fake); this.handleKey(fake);
this.lastNormalKeyDownEvent = undefined; this.lastNormalKeyDownEvent = undefined;
@ -3170,9 +3174,9 @@ VT100.prototype.keyUp = function(event) {
} else { } else {
fake.charCode = 0; fake.charCode = 0;
fake.keyCode = event.keyCode; fake.keyCode = event.keyCode;
if (!alphNumKey && (event.ctrlKey || event.altKey || event.metaKey)) { }
fake = this.fixEvent(fake); if (event.ctrlKey || event.altKey || event.metaKey) {
} fake = this.fixEvent(fake);
} }
this.lastNormalKeyDownEvent = undefined; this.lastNormalKeyDownEvent = undefined;
this.handleKey(fake); this.handleKey(fake);