improve wide char support.

This commit is contained in:
Christopher Jeffrey
2013-08-10 09:23:04 -05:00
parent d5b233b3f9
commit efa0e3c145
2 changed files with 26 additions and 4 deletions
+11
View File
@@ -66,6 +66,17 @@ app.use(express.static(__dirname + '/../lib'));
server.listen(8080);
server.on('connection', function(socket) {
var address = socket.remoteAddress;
if (address !== '127.0.0.1' && address !== '::1') {
try {
socket.destroy();
} catch (e) {
;
}
}
});
/**
* Sockets
*/
+15 -4
View File
@@ -1029,7 +1029,7 @@ Terminal.prototype.refresh = function(start, end) {
if (ch <= ' ') {
out += '&nbsp;';
} else {
// if (dwidthChars.test(ch)) i++;
// if (wideChars.test(ch)) i++;
out += ch;
}
break;
@@ -1138,7 +1138,7 @@ Terminal.prototype.write = function(data) {
, ch;
// If we want to remove double-width chars entirely.
// data = data.replace(dwidthChars, '?');
// data = data.replace(wideChars, '?');
this.refreshStart = this.y;
this.refreshEnd = this.y;
@@ -1231,7 +1231,18 @@ Terminal.prototype.write = function(data) {
this.lines[this.y + this.ybase][this.x] = [this.curAttr, ch];
this.x++;
this.updateRange(this.y);
// if (dwidthChars.test(ch)) this.x++;
// if (wideChars.test(ch)) {
// if (this.cols < 2) {
// this.lines[this.y + this.ybase][this.x - 1][1] = ' ';
// break;
// }
// this.x++;
// if (this.x >= this.cols) {
// this.lines[this.y + this.ybase][this.x - 2][1] = ' ';
// // Do something like: this.write(ch);
// }
// }
}
break;
}
@@ -4372,7 +4383,7 @@ function indexOf(obj, el) {
return -1;
}
var dwidthChars = new RegExp('(['
var wideChars = new RegExp('(['
+ '\\uff01-\\uffbe'
+ '\\uffc2-\\uffc7'
+ '\\uffca-\\uffcf'