From 678433a92f178e8fd8f7f0dc447363b8b415dd27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 6 Jun 2019 18:22:16 +0000 Subject: [PATCH 1/7] Bump js-yaml from 3.12.0 to 3.13.1 Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1) Signed-off-by: dependabot[bot] --- yarn.lock | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 61a70629..2c2be0f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1392,9 +1392,9 @@ esprima@^3.1.3: integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" - integrity sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw== + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esrecurse@^4.1.0: version "4.2.1" @@ -2294,7 +2294,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@3.13.1: +js-yaml@3.13.1, js-yaml@^3.7.0: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -2302,14 +2302,6 @@ js-yaml@3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.7.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" From 1473afd1b660b6812f761edea156bac60207d803 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jun 2019 12:40:06 -0700 Subject: [PATCH 2/7] Add addon docs to README Fixes #2192 --- README.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0f430355..71e6bd06 100644 --- a/README.md +++ b/README.md @@ -56,34 +56,33 @@ import { Terminal } from 'xterm'; ### Addons -Addons are JavaScript modules that extend the `Terminal` prototype with new methods and attributes to provide additional functionality. There are a handful available in the main repository in the `src/addons` directory and you can even write your own by using the [public API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). +⚠️ *This section describes the new addon format introduced in v3.14.0.* -To use an addon, just import the JavaScript module and pass it to `Terminal`'s `applyAddon` method: +Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon you first need to install it on your project: -```javascript -import { Terminal } from 'xterm'; -import * as fit from 'xterm/lib/addons/fit/fit'; - -Terminal.applyAddon(fit); - -var xterm = new Terminal(); // Instantiate the terminal -xterm.fit(); // Use the `fit` method, provided by the `fit` addon +```bash +npm i -S xterm-addon-web-links ``` -You will also need to include the addon's CSS file if it has one in the folder. +Then import it and call `Terminal.loadAddon`: -#### Importing Addons in TypeScript +```ts +import { Terminal } from 'xterm`; +import { WebLinksAddon } from 'xterm-addon-web-links`; -There are currently no typings for addons if they are accessed via extending Terminal prototype, so you will need to upcast if using TypeScript, eg. `(xterm as any).fit()`. Alternatively, you can import the addon function and enhance the terminal on demand. This has better typing support and is friendly to treeshaking. - -```typescript -import { Terminal } from 'xterm'; -import { fit } from 'xterm/lib/addons/fit/fit'; -const xterm = new Terminal(); - -fit(xterm); // Fit the terminal when necessary +const terminal = new Terminal(); +// Load WebLinksAddon on terminal, this is all that's needed to get web links +// working in the terminal. +terminal.loadAddon(new WebLinksAddon()); ``` +The xterm.js team maintains the following addons but they can be built by anyone: + +- [`xterm-addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-attach): Attaches to a server running a process via a websocket +- [`xterm-addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-fit): Fits the terminal to the containing element +- [`xterm-addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-search): Adds search functionality +- [`xterm-addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-web-links): Adds web link detection and interaction + ## Browser Support Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Here is a list of the versions we aim to support: From c4db8879ac640dccc5e17020fa5c5c14c094077a Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jun 2019 12:54:50 -0700 Subject: [PATCH 3/7] Improve grammar, add old addon link --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 71e6bd06..0b5a00ed 100644 --- a/README.md +++ b/README.md @@ -56,15 +56,15 @@ import { Terminal } from 'xterm'; ### Addons -⚠️ *This section describes the new addon format introduced in v3.14.0.* +⚠️ *This section describes the new addon format introduced in v3.14.0, see [here](https://github.com/xtermjs/xterm.js/blob/3.14.2/README.md#addons) for the instructions on the old format* -Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon you first need to install it on your project: +Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon you first need to install it in your project: ```bash npm i -S xterm-addon-web-links ``` -Then import it and call `Terminal.loadAddon`: +Then import the addon, instantiate it and call `Terminal.loadAddon`: ```ts import { Terminal } from 'xterm`; From f5ee335a43148e1080f2640874a5d8bcd3507129 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jun 2019 12:56:04 -0700 Subject: [PATCH 4/7] Fix addon import quotes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b5a00ed..aa89c700 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ npm i -S xterm-addon-web-links Then import the addon, instantiate it and call `Terminal.loadAddon`: ```ts -import { Terminal } from 'xterm`; -import { WebLinksAddon } from 'xterm-addon-web-links`; +import { Terminal } from 'xterm'; +import { WebLinksAddon } from 'xterm-addon-web-links'; const terminal = new Terminal(); // Load WebLinksAddon on terminal, this is all that's needed to get web links From 767eec3a2ca145c0e9a289835c8bc73e61c37ec4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jun 2019 14:57:49 -0700 Subject: [PATCH 5/7] Properly clone default attr data on DECSTR Fixes #2196 --- src/InputHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 1a4ef187..57f866c9 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1818,7 +1818,7 @@ export class InputHandler extends Disposable implements IInputHandler { this._terminal.applicationCursor = false; this._terminal.buffer.scrollTop = 0; this._terminal.buffer.scrollBottom = this._terminal.rows - 1; - this._terminal.curAttrData = DEFAULT_ATTR_DATA; + this._terminal.curAttrData = DEFAULT_ATTR_DATA.clone(); this._terminal.buffer.x = this._terminal.buffer.y = 0; // ? this._terminal.charset = null; this._terminal.glevel = 0; // ?? From d271095e288a5d23558a4ad06fccab22135b8942 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 6 Jun 2019 15:05:34 -0700 Subject: [PATCH 6/7] Freeze DEFAULT_ATTR_DATA to hard fail when not cloned --- src/core/buffer/BufferLine.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/buffer/BufferLine.ts b/src/core/buffer/BufferLine.ts index ce3b54b7..91c3a8d1 100644 --- a/src/core/buffer/BufferLine.ts +++ b/src/core/buffer/BufferLine.ts @@ -217,7 +217,7 @@ export class AttributeData implements IAttributeData { } } -export const DEFAULT_ATTR_DATA = new AttributeData(); +export const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData()); /** * CellData - represents a single Cell in the terminal buffer. From f3977afe779db72cfa2b4d6d22da1d9bd384a128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 7 Jun 2019 00:36:30 +0200 Subject: [PATCH 7/7] change TERM to xterm-256color in demo --- demo/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/server.js b/demo/server.js index 4b3f1bda..3b170813 100644 --- a/demo/server.js +++ b/demo/server.js @@ -40,7 +40,7 @@ function startServer() { var cols = parseInt(req.query.cols), rows = parseInt(req.query.rows), term = pty.spawn(process.platform === 'win32' ? 'cmd.exe' : 'bash', [], { - name: 'xterm-color', + name: 'xterm-256color', cols: cols || 80, rows: rows || 24, cwd: process.env.PWD,