diff --git a/example/index.js b/example/index.js index 04ca2140..0f2df1ff 100644 --- a/example/index.js +++ b/example/index.js @@ -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 */ diff --git a/lib/term.js b/lib/term.js index 0a4eb6e8..86ca41e6 100644 --- a/lib/term.js +++ b/lib/term.js @@ -1029,7 +1029,7 @@ Terminal.prototype.refresh = function(start, end) { if (ch <= ' ') { out += ' '; } 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'