Issue 43: 2.10 version introduces a keyboard layout problem

o From the author:

  I have a fix for the French and Swiss keyboard layout issues.  There
  was also a typo in the encoding of unicode characters that prevented
  from typing the Euro sign.  Attached is my patch.
This commit is contained in:
Marc Singer 2012-03-31 12:18:53 -07:00
parent b74ddd066b
commit ea179e89f7
2 changed files with 34 additions and 11 deletions

View file

@ -267,16 +267,16 @@ ShellInABox.prototype.keysPressed = function(ch) {
} else if (c < 0x10000) { } else if (c < 0x10000) {
s += 'E' + s += 'E' +
hex.charAt( (c >> 12) ) + hex.charAt( (c >> 12) ) +
hex.charAt(0x8 + (c >> 10) & 0x3 ) + hex.charAt(0x8 + ((c >> 10) & 0x3)) +
hex.charAt( (c >> 6) & 0xF ) + hex.charAt( (c >> 6) & 0xF ) +
hex.charAt(0x8 + ((c >> 4) & 0x3)) + hex.charAt(0x8 + ((c >> 4) & 0x3)) +
hex.charAt( c & 0xF ); hex.charAt( c & 0xF );
} else if (c < 0x110000) { } else if (c < 0x110000) {
s += 'F' + s += 'F' +
hex.charAt( (c >> 18) ) + hex.charAt( (c >> 18) ) +
hex.charAt(0x8 + (c >> 16) & 0x3 ) + hex.charAt(0x8 + ((c >> 16) & 0x3)) +
hex.charAt( (c >> 12) & 0xF ) + hex.charAt( (c >> 12) & 0xF ) +
hex.charAt(0x8 + (c >> 10) & 0x3 ) + hex.charAt(0x8 + ((c >> 10) & 0x3)) +
hex.charAt( (c >> 6) & 0xF ) + hex.charAt( (c >> 6) & 0xF ) +
hex.charAt(0x8 + ((c >> 4) & 0x3)) + hex.charAt(0x8 + ((c >> 4) & 0x3)) +
hex.charAt( c & 0xF ); hex.charAt( c & 0xF );

View file

@ -2719,10 +2719,14 @@ VT100.prototype.handleKey = function(event) {
case 189: /* - */ ch = this.applyModifiers(45, event); break; case 189: /* - */ ch = this.applyModifiers(45, event); break;
case 190: /* . */ ch = this.applyModifiers(46, event); break; case 190: /* . */ ch = this.applyModifiers(46, event); break;
case 191: /* / */ ch = this.applyModifiers(47, event); break; case 191: /* / */ ch = this.applyModifiers(47, event); break;
case 192: /* ` */ ch = this.applyModifiers(96, event); break; // Conflicts with dead key " on Swiss keyboards
case 219: /* [ */ ch = this.applyModifiers(91, event); break; //case 192: /* ` */ ch = this.applyModifiers(96, event); break;
// Conflicts with dead key " on Swiss keyboards
//case 219: /* [ */ ch = this.applyModifiers(91, event); break;
case 220: /* \ */ ch = this.applyModifiers(92, event); break; case 220: /* \ */ ch = this.applyModifiers(92, event); break;
case 221: /* ] */ ch = this.applyModifiers(93, event); break; // Conflicts with dead key ^ and ` on Swiss keaboards
// ^ and " on French keyboards
//case 221: /* ] */ ch = this.applyModifiers(93, event); break;
case 222: /* ' */ ch = this.applyModifiers(39, event); break; case 222: /* ' */ ch = this.applyModifiers(39, event); break;
default: return; default: return;
} }
@ -2892,21 +2896,36 @@ VT100.prototype.keyDown = function(event) {
this.lastKeyDownEvent = undefined; this.lastKeyDownEvent = undefined;
this.lastNormalKeyDownEvent = event; this.lastNormalKeyDownEvent = event;
// Swiss keyboard conflicts:
// [ 59
// ] 192
// ' 219 (dead key)
// { 220
// ~ 221 (dead key)
// } 223
// French keyoard conflicts:
// ~ 50 (dead key)
// } 107
var asciiKey = var asciiKey =
event.keyCode == 32 || event.keyCode == 32 ||
event.keyCode >= 48 && event.keyCode <= 57 || event.keyCode >= 48 && event.keyCode <= 57 ||
event.keyCode >= 65 && event.keyCode <= 90; event.keyCode >= 65 && event.keyCode <= 90;
var alphNumKey = var alphNumKey =
asciiKey || asciiKey ||
event.keyCode == 59 ||
event.keyCode >= 96 && event.keyCode <= 105 || event.keyCode >= 96 && event.keyCode <= 105 ||
event.keyCode == 107 ||
event.keyCode == 192 ||
event.keyCode >= 219 && event.keyCode <= 221 ||
event.keyCode == 223 ||
event.keyCode == 226; event.keyCode == 226;
var normalKey = var normalKey =
alphNumKey || alphNumKey ||
event.keyCode == 59 || event.keyCode == 61 || event.keyCode == 61 ||
event.keyCode == 106 || event.keyCode == 107 || event.keyCode == 106 ||
event.keyCode >= 109 && event.keyCode <= 111 || event.keyCode >= 109 && event.keyCode <= 111 ||
event.keyCode >= 186 && event.keyCode <= 192 || event.keyCode >= 186 && event.keyCode <= 191 ||
event.keyCode >= 219 && event.keyCode <= 223 || event.keyCode == 222 ||
event.keyCode == 252; event.keyCode == 252;
try { try {
if (navigator.appName == 'Konqueror') { if (navigator.appName == 'Konqueror') {
@ -3034,10 +3053,14 @@ VT100.prototype.keyUp = function(event) {
this.catchModifiersEarly = true; this.catchModifiersEarly = true;
var asciiKey = var asciiKey =
event.keyCode == 32 || event.keyCode == 32 ||
event.keyCode >= 48 && event.keyCode <= 57 || // Conflicts with dead key ~ (code 50) on French keyboards
//event.keyCode >= 48 && event.keyCode <= 57 ||
event.keyCode >= 48 && event.keyCode <= 49 ||
event.keyCode >= 51 && event.keyCode <= 57 ||
event.keyCode >= 65 && event.keyCode <= 90; event.keyCode >= 65 && event.keyCode <= 90;
var alphNumKey = var alphNumKey =
asciiKey || asciiKey ||
event.keyCode == 50 ||
event.keyCode >= 96 && event.keyCode <= 105; event.keyCode >= 96 && event.keyCode <= 105;
var normalKey = var normalKey =
alphNumKey || alphNumKey ||