Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xterm

Package Overview
Dependencies
Maintainers
1
Versions
1092
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xterm - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

.babelrc

2

addons/attach/attach.js

@@ -24,3 +24,3 @@ /*

*/
attach(this.Xterm);
attach(window.Terminal);
}

@@ -27,0 +27,0 @@ })(function (Xterm) {

@@ -29,3 +29,3 @@ /*

*/
fit(this.Xterm);
fit(window.Terminal);
}

@@ -32,0 +32,0 @@ })(function (Xterm) {

@@ -28,3 +28,3 @@ /*

*/
fullscreen(this.Xterm);
fullscreen(window.Terminal);
}

@@ -31,0 +31,0 @@ })(function (Xterm) {

@@ -16,3 +16,3 @@ (function (linkify) {

*/
linkify(this.Xterm);
linkify(window.Terminal);
}

@@ -19,0 +19,0 @@ })(function (Xterm) {

{
"name": "xterm.js",
"version": "1.1.3",
"version": "2.0.0",
"ignore": ["demo", "test", ".gitignore"]
}

@@ -10,3 +10,3 @@ var express = require('express');

app.use('/src', express.static(__dirname + '/../src'));
app.use('/build', express.static(__dirname + '/../build'));
app.use('/addons', express.static(__dirname + '/../addons'));

@@ -13,0 +13,0 @@

@@ -5,2 +5,3 @@ {

"src/xterm.js",
"src/handlers/Clipboard.js",
"addons/attach/attach.js",

@@ -7,0 +8,0 @@ "addons/fit/fit.js",

{
"name": "xterm",
"version": "1.1.3",
"version": "2.0.0",
"ignore": [

@@ -9,8 +9,14 @@ "demo",

],
"main": "src/xterm.js",
"main": "dist/xterm.js",
"repository": "https://github.com/sourcelair/xterm.js",
"license": "MIT",
"devDependencies": {
"babel-core": "6.14.0",
"babel-preset-es2015": "6.14.0",
"babelify": "^7.3.0",
"browserify": "^13.1.0",
"chai": "3.5.0",
"derequire": "^2.0.3",
"docdash": "0.4.0",
"exorcist": "^0.4.0",
"express": "4.13.4",

@@ -21,2 +27,3 @@ "express-ws": "2.0.0-rc.1",

"mocha": "2.5.3",
"nodemon": "1.10.2",
"pty.js": "0.3.1",

@@ -26,6 +33,7 @@ "sleep": "^3.0.1"

"scripts": {
"start": "node demo/app",
"test": "mocha --recursive",
"build:docs": "node_modules/.bin/jsdoc -c jsdoc.json"
"start": "nodemon --watch src --watch addons --exec bash -c './bin/build && node demo/app'",
"test": "mocha --recursive --compilers js:babel-core/register",
"build:docs": "jsdoc -c jsdoc.json",
"build": "./bin/build"
}
}

@@ -26,3 +26,3 @@ # xterm.js

- [**SourceLair**](https://www.sourcelair.com/): In-browser IDE that provides its users with fully-featured Linux terminals based on xterm.js
- [**Microsoft Visual Studio Code**](http://code.visualstudio.com/): Modern, versatile, powerful and open source code editor that provides integrated terminal based on xterm.js
- [**Microsoft Visual Studio Code**](http://code.visualstudio.com/): Modern, versatile and powerful open source code editor that provides an integrated terminal based on xterm.js

@@ -53,3 +53,3 @@ Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it in our list.

Then open http://0.0.0.0:3000 in a web browser (use http://127.0.0.1:3000 is running under Windows).
Then open http://0.0.0.0:3000 in a web browser (use http://127.0.0.1:3000 if running under Windows).

@@ -63,3 +63,3 @@ ## Addons

```html
<script src="node_modules/src/xterm.js"></script>
<script src="node_modules/dist/xterm.js"></script>
<script src="node_modules/addons/fit/fit.js"></script>

@@ -66,0 +66,0 @@ ```

@@ -18,3 +18,3 @@ var assert = require('chai').assert;

getBoundingClientRect: function () {
return { width: 0 }
return { width: 0 };
},

@@ -21,0 +21,0 @@ style: {

@@ -30,3 +30,3 @@ var glob = require('glob');

// make sure raw pty is at x=0 and has no pending data
// make sure raw pty is at x=0 and has no pending data
function pty_reset() {

@@ -33,0 +33,0 @@ pty_write_read('\r\n');

@@ -11,4 +11,82 @@ var assert = require('chai').assert;

xterm.refresh = function(){};
xterm.viewport = {
syncScrollArea: function(){}
};
});
describe('getOption', function() {
it('should retrieve the option correctly', function() {
// In the `options` namespace.
xterm.options.cursorBlink = true;
assert.equal(xterm.getOption('cursorBlink'), true);
// On the Terminal instance
delete xterm.options.cursorBlink;
xterm.cursorBlink = false;
assert.equal(xterm.getOption('cursorBlink'), false);
});
it('should throw when retrieving a non-existant option', function() {
assert.throws(xterm.getOption.bind(xterm, 'fake', true));
});
});
describe('setOption', function() {
it('should set the option correctly', function() {
xterm.setOption('cursorBlink', true);
assert.equal(xterm.cursorBlink, true);
assert.equal(xterm.options.cursorBlink, true);
xterm.setOption('cursorBlink', false);
assert.equal(xterm.cursorBlink, false);
assert.equal(xterm.options.cursorBlink, false);
});
it('should throw when setting a non-existant option', function() {
assert.throws(xterm.setOption.bind(xterm, 'fake', true));
});
});
describe('clear', function() {
it('should clear a buffer equal to rows', function() {
var promptLine = xterm.lines[xterm.ybase + xterm.y];
xterm.clear();
assert.equal(xterm.y, 0);
assert.equal(xterm.ybase, 0);
assert.equal(xterm.ydisp, 0);
assert.equal(xterm.lines.length, xterm.rows);
assert.deepEqual(xterm.lines[0], promptLine);
for (var i = 1; i < xterm.rows; i++) {
assert.deepEqual(xterm.lines[0], xterm.blankLine());
}
});
it('should clear a buffer larger than rows', function() {
// Fill the buffer with dummy rows
for (var i = 0; i < xterm.rows * 2; i++) {
xterm.write('test\n');
}
var promptLine = xterm.lines[xterm.ybase + xterm.y];
xterm.clear();
assert.equal(xterm.y, 0);
assert.equal(xterm.ybase, 0);
assert.equal(xterm.ydisp, 0);
assert.equal(xterm.lines.length, xterm.rows);
assert.deepEqual(xterm.lines[0], promptLine);
for (var i = 1; i < xterm.rows; i++) {
assert.deepEqual(xterm.lines[i], xterm.blankLine());
}
});
it('should not break the prompt when cleared twice', function() {
var promptLine = xterm.lines[xterm.ybase + xterm.y];
xterm.clear();
xterm.clear();
assert.equal(xterm.y, 0);
assert.equal(xterm.ybase, 0);
assert.equal(xterm.ydisp, 0);
assert.equal(xterm.lines.length, xterm.rows);
assert.deepEqual(xterm.lines[0], promptLine);
for (var i = 1; i < xterm.rows; i++) {
assert.deepEqual(xterm.lines[i], xterm.blankLine());
}
});
});
describe('evaluateKeyEscapeSequence', function() {

@@ -53,2 +131,11 @@ it('should return the correct escape sequence for unmodified keys', function() {

});
it('should return \\x1b[3;5~ for ctrl+delete', function() {
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 46 }).key, '\x1b[3;5~');
});
it('should return \\x1b[3;2~ for shift+delete', function() {
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 46 }).key, '\x1b[3;2~');
});
it('should return \\x1b[3;3~ for alt+delete', function() {
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 46 }).key, '\x1b[3;3~');
});
it('should return \\x1b[5D for ctrl+left', function() {

@@ -80,2 +167,41 @@ assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D

});
it('should return the correct escape sequence for modified F1-F12 keys', function() {
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 112 }).key, '\x1b[1;2P');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 113 }).key, '\x1b[1;2Q');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 114 }).key, '\x1b[1;2R');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 115 }).key, '\x1b[1;2S');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 116 }).key, '\x1b[15;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 117 }).key, '\x1b[17;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 118 }).key, '\x1b[18;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 119 }).key, '\x1b[19;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 120 }).key, '\x1b[20;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 121 }).key, '\x1b[21;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 122 }).key, '\x1b[23;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ shiftKey: true, keyCode: 123 }).key, '\x1b[24;2~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 112 }).key, '\x1b[1;3P');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 113 }).key, '\x1b[1;3Q');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 114 }).key, '\x1b[1;3R');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 115 }).key, '\x1b[1;3S');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 116 }).key, '\x1b[15;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 117 }).key, '\x1b[17;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 118 }).key, '\x1b[18;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 119 }).key, '\x1b[19;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 120 }).key, '\x1b[20;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 121 }).key, '\x1b[21;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 122 }).key, '\x1b[23;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 123 }).key, '\x1b[24;3~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 112 }).key, '\x1b[1;5P');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 113 }).key, '\x1b[1;5Q');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 114 }).key, '\x1b[1;5R');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 115 }).key, '\x1b[1;5S');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 116 }).key, '\x1b[15;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 117 }).key, '\x1b[17;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 118 }).key, '\x1b[18;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 119 }).key, '\x1b[19;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 120 }).key, '\x1b[20;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 121 }).key, '\x1b[21;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 122 }).key, '\x1b[23;5~');
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 123 }).key, '\x1b[24;5~');
});
});

@@ -125,16 +251,2 @@

describe('evaluateCopiedTextProcessing', function () {
it('should strip trailing whitespaces and replace nbsps with spaces', function () {
var nonBreakingSpace = String.fromCharCode(160),
copiedText = 'echo' + nonBreakingSpace + 'hello' + nonBreakingSpace,
processedText = Terminal.prepareCopiedTextForClipboard(copiedText);
// No trailing spaces
assert.equal(processedText.match(/\s+$/), null);
// No non-breaking space
assert.equal(processedText.indexOf(nonBreakingSpace), -1);
});
});
describe('Third level shift', function() {

@@ -278,3 +390,3 @@ var evKeyDown = {

it('2 characters per cell', function () {
var high = '\uD800';
var high = String.fromCharCode(0xD800);
for (var i=0xDC00; i<=0xDCFF; ++i) {

@@ -291,3 +403,3 @@ xterm.write(high + String.fromCharCode(i));

it('2 characters at last cell', function() {
var high = '\uD800';
var high = String.fromCharCode(0xD800);
for (var i=0xDC00; i<=0xDCFF; ++i) {

@@ -303,3 +415,3 @@ xterm.x = xterm.cols - 1;

it('2 characters per cell over line end with autowrap', function() {
var high = '\uD800';
var high = String.fromCharCode(0xD800);
for (var i=0xDC00; i<=0xDCFF; ++i) {

@@ -317,3 +429,3 @@ xterm.x = xterm.cols - 1;

it('2 characters per cell over line end without autowrap', function() {
var high = '\uD800';
var high = String.fromCharCode(0xD800);
for (var i=0xDC00; i<=0xDCFF; ++i) {

@@ -330,3 +442,3 @@ xterm.x = xterm.cols - 1;

it('splitted surrogates', function() {
var high = '\uD800';
var high = String.fromCharCode(0xD800);
for (var i=0xDC00; i<=0xDCFF; ++i) {

@@ -333,0 +445,0 @@ xterm.write(high);

@@ -9,2 +9,3 @@ var assert = require('chai').assert;

var viewport;
var scrollAreaElement;

@@ -49,21 +50,4 @@ var CHARACTER_HEIGHT = 10;

});
it('should define Viewport.prototype.setApplicationMode', function () {
assert.isDefined(Terminal.Viewport.prototype.setApplicationMode);
});
});
describe('setApplicationMode', function () {
it('should restrict the scroll area to the viewport', function () {
terminal.lines.push('');
terminal.lines.push('');
terminal.rows = 1;
viewport.syncScrollArea();
assert.equal(scrollAreaElement.style.height, 2 * CHARACTER_HEIGHT + 'px');
viewport.setApplicationMode(true);
assert.equal(scrollAreaElement.style.height, CHARACTER_HEIGHT + 'px');
viewport.setApplicationMode(false);
assert.equal(scrollAreaElement.style.height, 2 * CHARACTER_HEIGHT + 'px');
});
});
describe('refresh', function () {

@@ -70,0 +54,0 @@ it('should set the line-height of the terminal', function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc