Improved support for entering non-ASCII characters.

git-svn-id: https://shellinabox.googlecode.com/svn/trunk@120 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
zodiac@gmail.com 2009-05-23 05:56:16 +00:00
parent 41fd8f3ea5
commit 60b5f38d74
10 changed files with 2419 additions and 2146 deletions

View file

@ -1,3 +1,7 @@
2009-05-22 Markus Gutschke <markus@shellinabox.com>
* Improved support for entering non-ASCII characters.
2009-05-20 Markus Gutschke <markus@shellinabox.com> 2009-05-20 Markus Gutschke <markus@shellinabox.com>
* Fixed various issues with building on OpenBSD * Fixed various issues with building on OpenBSD

View file

@ -129,7 +129,7 @@
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Most recent revision number in the version control system */ /* Most recent revision number in the version control system */
#define VCS_REVISION "119" #define VCS_REVISION "120"
/* Version number of package */ /* Version number of package */
#define VERSION "2.7" #define VERSION "2.7"

4322
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ AC_PREREQ(2.57)
dnl This is the one location where the authoritative version number is stored dnl This is the one location where the authoritative version number is stored
AC_INIT(shellinabox, 2.7, markus@shellinabox.com) AC_INIT(shellinabox, 2.7, markus@shellinabox.com)
VCS_REVISION=119 VCS_REVISION=120
AC_SUBST(VCS_REVISION) AC_SUBST(VCS_REVISION)
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
[Most recent revision number in the version control system]) [Most recent revision number in the version control system])

View file

@ -89,17 +89,32 @@ function Demo(container) {
extend(Demo, VT100); extend(Demo, VT100);
Demo.prototype.keysPressed = function(ch) { Demo.prototype.keysPressed = function(ch) {
if (this.state == 5 /* STATE_EXEC */) {
for (var i = 0; i < ch.length; i++) { for (var i = 0; i < ch.length; i++) {
var c = ch.charAt(i); var c = ch.charCodeAt(i);
if (c == '\u0003') { if (c == 3) {
if (this.state == 5 /* STATE_EXEC */) {
this.keys = ''; this.keys = '';
this.error('Interrupted'); this.error('Interrupted');
return; return;
} }
} else {
if (c < 128) {
this.keys += String.fromCharCode(c);
} else if (c < 0x800) {
this.keys += String.fromCharCode(0xC0 + (c >> 6) ) +
String.fromCharCode(0x80 + ( c & 0x3F));
} else if (c < 0x10000) {
this.keys += String.fromCharCode(0xE0 + (c >> 12) ) +
String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) +
String.fromCharCode(0x80 + ( c & 0x3F));
} else if (c < 0x110000) {
this.keys += String.fromCharCode(0xF0 + (c >> 18) ) +
String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) +
String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) +
String.fromCharCode(0x80 + ( c & 0x3F));
}
} }
} }
this.keys += ch;
this.gotoState(this.state); this.gotoState(this.state);
}; };
@ -206,7 +221,7 @@ Demo.prototype.doReadLine = function() {
this.keys = ''; this.keys = '';
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var ch = keys.charAt(i); var ch = keys.charAt(i);
if (ch >= ' ' && ch < '\u007F' || ch > '\u00A0') { if (ch >= ' ') {
this.line += ch; this.line += ch;
this.vt100(ch); this.vt100(ch);
} else if (ch == '\r' || ch == '\n') { } else if (ch == '\r' || ch == '\n') {

View file

@ -89,17 +89,32 @@ function Demo(container) {
extend(Demo, VT100); extend(Demo, VT100);
Demo.prototype.keysPressed = function(ch) { Demo.prototype.keysPressed = function(ch) {
if (this.state == STATE_EXEC) {
for (var i = 0; i < ch.length; i++) { for (var i = 0; i < ch.length; i++) {
var c = ch.charAt(i); var c = ch.charCodeAt(i);
if (c == '\u0003') { if (c == 3) {
if (this.state == STATE_EXEC) {
this.keys = ''; this.keys = '';
this.error('Interrupted'); this.error('Interrupted');
return; return;
} }
} else {
if (c < 128) {
this.keys += String.fromCharCode(c);
} else if (c < 0x800) {
this.keys += String.fromCharCode(0xC0 + (c >> 6) ) +
String.fromCharCode(0x80 + ( c & 0x3F));
} else if (c < 0x10000) {
this.keys += String.fromCharCode(0xE0 + (c >> 12) ) +
String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) +
String.fromCharCode(0x80 + ( c & 0x3F));
} else if (c < 0x110000) {
this.keys += String.fromCharCode(0xF0 + (c >> 18) ) +
String.fromCharCode(0x80 + ((c >> 12) & 0x3F)) +
String.fromCharCode(0x80 + ((c >> 6) & 0x3F)) +
String.fromCharCode(0x80 + ( c & 0x3F));
}
} }
} }
this.keys += ch;
this.gotoState(this.state); this.gotoState(this.state);
}; };
@ -206,7 +221,7 @@ Demo.prototype.doReadLine = function() {
this.keys = ''; this.keys = '';
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var ch = keys.charAt(i); var ch = keys.charAt(i);
if (ch >= ' ' && ch < '\u007F' || ch > '\u00A0') { if (ch >= ' ') {
this.line += ch; this.line += ch;
this.vt100(ch); this.vt100(ch);
} else if (ch == '\r' || ch == '\n') { } else if (ch == '\r' || ch == '\n') {

View file

@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
}; };
VT100.prototype.about = function() { VT100.prototype.about = function() {
alert("VT100 Terminal Emulator " + "2.7 (revision 119)" + alert("VT100 Terminal Emulator " + "2.7 (revision 120)" +
"\nCopyright 2008-2009 by Markus Gutschke\n" + "\nCopyright 2008-2009 by Markus Gutschke\n" +
"For more information check http://shellinabox.com"); "For more information check http://shellinabox.com");
}; };
@ -1937,11 +1937,12 @@ VT100.prototype.keyDown = function(event) {
// Even, when doing all of this, there are some keys that we can never // Even, when doing all of this, there are some keys that we can never
// intercept. This applies to some of the menu navigation keys in IE. // intercept. This applies to some of the menu navigation keys in IE.
// In fact, we see them, but we cannot stop IE from seeing them, too. // In fact, we see them, but we cannot stop IE from seeing them, too.
if ((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) && if ((event.charCode || event.keyCode) &&
((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) &&
!event.shiftKey) || !event.shiftKey) ||
this.catchModifiersEarly && normalKey && !alphNumKey && this.catchModifiersEarly && normalKey && !alphNumKey &&
(event.ctrlKey || event.altKey || event.metaKey) || (event.ctrlKey || event.altKey || event.metaKey) ||
!normalKey) { !normalKey)) {
this.lastKeyDownEvent = event; this.lastKeyDownEvent = event;
var fake = [ ]; var fake = [ ];
fake.ctrlKey = event.ctrlKey; fake.ctrlKey = event.ctrlKey;

View file

@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
}; };
ShellInABox.prototype.about = function() { ShellInABox.prototype.about = function() {
alert("Shell In A Box version " + "2.7 (revision 119)" + alert("Shell In A Box version " + "2.7 (revision 120)" +
"\nCopyright 2008-2009 by Markus Gutschke\n" + "\nCopyright 2008-2009 by Markus Gutschke\n" +
"For more information check http://shellinabox.com" + "For more information check http://shellinabox.com" +
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?

View file

@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
}; };
VT100.prototype.about = function() { VT100.prototype.about = function() {
alert("VT100 Terminal Emulator " + "2.7 (revision 119)" + alert("VT100 Terminal Emulator " + "2.7 (revision 120)" +
"\nCopyright 2008-2009 by Markus Gutschke\n" + "\nCopyright 2008-2009 by Markus Gutschke\n" +
"For more information check http://shellinabox.com"); "For more information check http://shellinabox.com");
}; };
@ -1937,11 +1937,12 @@ VT100.prototype.keyDown = function(event) {
// Even, when doing all of this, there are some keys that we can never // Even, when doing all of this, there are some keys that we can never
// intercept. This applies to some of the menu navigation keys in IE. // intercept. This applies to some of the menu navigation keys in IE.
// In fact, we see them, but we cannot stop IE from seeing them, too. // In fact, we see them, but we cannot stop IE from seeing them, too.
if ((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) && if ((event.charCode || event.keyCode) &&
((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) &&
!event.shiftKey) || !event.shiftKey) ||
this.catchModifiersEarly && normalKey && !alphNumKey && this.catchModifiersEarly && normalKey && !alphNumKey &&
(event.ctrlKey || event.altKey || event.metaKey) || (event.ctrlKey || event.altKey || event.metaKey) ||
!normalKey) { !normalKey)) {
this.lastKeyDownEvent = event; this.lastKeyDownEvent = event;
var fake = [ ]; var fake = [ ];
fake.ctrlKey = event.ctrlKey; fake.ctrlKey = event.ctrlKey;

View file

@ -1937,11 +1937,12 @@ VT100.prototype.keyDown = function(event) {
// Even, when doing all of this, there are some keys that we can never // Even, when doing all of this, there are some keys that we can never
// intercept. This applies to some of the menu navigation keys in IE. // intercept. This applies to some of the menu navigation keys in IE.
// In fact, we see them, but we cannot stop IE from seeing them, too. // In fact, we see them, but we cannot stop IE from seeing them, too.
if ((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) && if ((event.charCode || event.keyCode) &&
((alphNumKey && (event.ctrlKey || event.altKey || event.metaKey) &&
!event.shiftKey) || !event.shiftKey) ||
this.catchModifiersEarly && normalKey && !alphNumKey && this.catchModifiersEarly && normalKey && !alphNumKey &&
(event.ctrlKey || event.altKey || event.metaKey) || (event.ctrlKey || event.altKey || event.metaKey) ||
!normalKey) { !normalKey)) {
this.lastKeyDownEvent = event; this.lastKeyDownEvent = event;
var fake = [ ]; var fake = [ ];
fake.ctrlKey = event.ctrlKey; fake.ctrlKey = event.ctrlKey;