This commit is contained in:
Christopher Jeffrey
2013-08-08 09:27:30 -05:00
parent 6cc8b3cd8a
commit 14248234d4
5 changed files with 25 additions and 5 deletions
+5 -2
View File
@@ -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
+1 -1
View File
@@ -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
*/
+12
View File
@@ -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
*/
+6 -1
View File
@@ -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"
}
}
+1 -1
View File
@@ -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);