From 14248234d4f508d1989a89a0ab2bf2d0c821a5cf Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 8 Aug 2013 09:13:36 -0500 Subject: [PATCH] v0.0.1 --- README.md | 7 +++++-- lib/index.js | 2 +- lib/term.js | 12 ++++++++++++ package.json | 7 ++++++- test/index.js | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index decada8e..d040a15a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Server: ``` js var term = require('term.js'); express.use(term.middleware()); +... ``` Client: @@ -27,6 +28,10 @@ window.addEventListener('load', function() { console.log(data); }); + term.on('title', function(title) { + console.log('New title: ' + title); + }); + term.write('\x1b[41hello world\x1b[m'); }, false); ``` @@ -34,5 +39,3 @@ window.addEventListener('load', function() { ## License Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) - -[1]: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking diff --git a/lib/index.js b/lib/index.js index 2f4e508f..97d71b91 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,6 @@ /** * term.js - an xterm emulator - * Copyright (c) 2013, Christopher Jeffrey (MIT License) + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) * https://github.com/chjj/term.js */ diff --git a/lib/term.js b/lib/term.js index 073ee199..2693d6f0 100644 --- a/lib/term.js +++ b/lib/term.js @@ -1104,6 +1104,8 @@ Terminal.prototype.scrollDisp = function(disp) { }; Terminal.prototype.write = function(data) { + // data = data.replace(dwidthChars, '?'); + var l = data.length , i = 0 , cs @@ -4336,6 +4338,16 @@ function indexOf(obj, el) { return -1; } +var dwidthChars = new RegExp('([' + + '\\uff01-\\uffbe' + + '\\uffc2-\\uffc7' + + '\\uffca-\\uffcf' + + '\\uffd2-\\uffd7' + + '\\uffda-\\uffdc' + + '\\uffe0-\\uffe6' + + '\\uffe8-\\uffee' + + '])', 'g'); + /** * Expose */ diff --git a/package.json b/package.json index e70b78fc..b2def679 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,10 @@ "bugs": { "url": "https://github.com/chjj/term.js/issues" }, "keywords": ["tty", "terminal", "term"], "tags": ["tty", "terminal", "term"], - "engines": { "node": ">= 0.8.0" } + "engines": { "node": ">= 0.8.0" }, + "devDependencies": { + "express": "3.1.0", + "socket.io": "0.9.13", + "pty.js": "0.2.3" + } } diff --git a/test/index.js b/test/index.js index 4118cc28..42dc16c5 100644 --- a/test/index.js +++ b/test/index.js @@ -20,6 +20,6 @@ app.use(function(req, res, next) { app.use(express.static(__dirname)); -app.use(express.static(__dirname + '/../static')); +app.use(express.static(__dirname + '/../lib')); app.listen(8080);