Skip to content

Commit fdae613

Browse files
authored
Merge branch 'master' into bufferRange
2 parents 09acb2b + 19c9fef commit fdae613

40 files changed

+1695
-1745
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:10
1+
FROM node:14
22

33
# Configure apt
44
ENV DEBIAN_FRONTEND=noninteractive

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@
4343
"@typescript-eslint/array-type": [
4444
"warn",
4545
{
46-
"default": "array-simple",
46+
"default": "array",
4747
"readonly": "generic"
4848
}
4949
],
50+
"@typescript-eslint/consistent-type-assertions": "warn",
5051
"@typescript-eslint/consistent-type-definitions": "warn",
5152
"@typescript-eslint/explicit-function-return-type": [
5253
"warn",

.vscode/tasks.json

Lines changed: 68 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,70 @@
11
{
2-
"version": "2.0.0",
3-
"presentation": {
4-
"echo": false,
5-
"reveal": "always",
6-
"focus": false,
7-
"panel": "dedicated",
8-
"showReuseMessage": true
9-
},
10-
"tasks": [
11-
{
12-
"type": "npm",
13-
"script": "test",
14-
"group": "test",
15-
"problemMatcher": []
16-
},
17-
{
18-
"type": "npm",
19-
"script": "watch",
20-
"group": "build",
21-
"isBackground": true,
22-
"problemMatcher": [],
23-
"presentation": {
24-
"group": "vscode"
25-
}
26-
},
27-
{
28-
"type": "npm",
29-
"script": "start",
30-
"group": "build",
31-
"isBackground": true,
32-
"problemMatcher": [],
33-
"presentation": {
34-
"group": "vscode"
35-
}
36-
},
37-
{
38-
"label": "Start demo",
39-
"dependsOn": ["npm: watch", "npm: start"],
40-
"group": {
41-
"kind": "build",
42-
"isDefault": true
43-
},
44-
"isBackground": true,
45-
"problemMatcher": [],
46-
"presentation": {
47-
"group": "vscode"
48-
}
49-
}
50-
]
2+
"version": "2.0.0",
3+
"presentation": {
4+
"echo": false,
5+
"reveal": "always",
6+
"focus": false,
7+
"panel": "dedicated",
8+
"showReuseMessage": true
9+
},
10+
"tasks": [
11+
{
12+
"type": "npm",
13+
"script": "test",
14+
"group": "test",
15+
"problemMatcher": []
16+
},
17+
{
18+
"type": "npm",
19+
"script": "watch",
20+
"group": "build",
21+
"isBackground": true,
22+
"problemMatcher": "$tsc-watch",
23+
"presentation": {
24+
"group": "vscode"
25+
}
26+
},
27+
{
28+
"type": "npm",
29+
"script": "start",
30+
"dependsOn": "npm: watch",
31+
"group": "build",
32+
"isBackground": true,
33+
"problemMatcher": [],
34+
"presentation": {
35+
"group": "vscode"
36+
}
37+
},
38+
{
39+
"label": "Start demo",
40+
"dependsOn": "npm: start",
41+
"group": {
42+
"kind": "build",
43+
"isDefault": true
44+
},
45+
"isBackground": true,
46+
"problemMatcher": {
47+
"owner": "typescript",
48+
"fileLocation": [
49+
"relative",
50+
"${workspaceFolder}"
51+
],
52+
"pattern": [
53+
{
54+
"regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",
55+
"file": 1,
56+
"location": 2,
57+
"message": 3
58+
}
59+
],
60+
"background": {
61+
"beginsPattern": "assets by",
62+
"endsPattern": "webpack \\d+\\.\\d+\\.\\d+ compiled successfully"
63+
}
64+
},
65+
"presentation": {
66+
"group": "vscode"
67+
}
68+
}
69+
]
5170
}

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Xterm.js is a front-end component written in TypeScript that lets applications b
66

77
## Features
88

9-
- **Terminal apps just work**: Xterm.js works with most terminal apps such as `bash`, `vim` and `tmux`, this includes support for curses-based apps and mouse event support.
9+
- **Terminal apps just work**: Xterm.js works with most terminal apps such as `bash`, `vim`, and `tmux`, including support for curses-based apps and mouse events.
1010
- **Performant**: Xterm.js is *really* fast, it even includes a GPU-accelerated renderer.
11-
- **Rich unicode support**: Supports CJK, emojis and IMEs.
11+
- **Rich Unicode support**: Supports CJK, emojis, and IMEs.
1212
- **Self-contained**: Requires zero dependencies to work.
13-
- **Accessible**: Screen reader and minimum contrast ratio support can be turned on
13+
- **Accessible**: Screen reader and minimum contrast ratio support can be turned on.
1414
- **And much more**: Links, theming, addons, well documented API, etc.
1515

1616
## What xterm.js is not
@@ -20,13 +20,13 @@ Xterm.js is a front-end component written in TypeScript that lets applications b
2020

2121
## Getting Started
2222

23-
First you need to install the module, we ship exclusively through [npm](https://www.npmjs.com/) so you need that installed and then add xterm.js as a dependency by running:
23+
First, you need to install the module, we ship exclusively through [npm](https://www.npmjs.com/), so you need that installed and then add xterm.js as a dependency by running:
2424

25-
```
25+
```bash
2626
npm install xterm
2727
```
2828

29-
To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to the head of your html page. Then create a `<div id="terminal"></div>` onto which xterm can attach itself. Finally instantiate the `Terminal` object and then call the `open` function with the DOM object of the `div`.
29+
To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to the head of your HTML page. Then create a `<div id="terminal"></div>` onto which xterm can attach itself. Finally, instantiate the `Terminal` object and then call the `open` function with the DOM object of the `div`.
3030

3131
```html
3232
<!doctype html>
@@ -58,7 +58,7 @@ import { Terminal } from 'xterm';
5858

5959
⚠️ *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*
6060

61-
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:
61+
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:
6262

6363
```bash
6464
npm i -S xterm-addon-web-links
@@ -76,7 +76,7 @@ const terminal = new Terminal();
7676
terminal.loadAddon(new WebLinksAddon());
7777
```
7878

79-
The xterm.js team maintains the following addons but they can be built by anyone:
79+
The xterm.js team maintains the following addons, but anyone can build them:
8080

8181
- [`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
8282
- [`xterm-addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-fit): Fits the terminal to the containing element
@@ -85,23 +85,23 @@ The xterm.js team maintains the following addons but they can be built by anyone
8585

8686
## Browser Support
8787

88-
Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Specifically the latest versions of *Chrome*, *Edge*, *Firefox* and *Safari*.
88+
Since xterm.js is typically implemented as a developer tool, only modern browsers are supported officially. Specifically the latest versions of *Chrome*, *Edge*, *Firefox*, and *Safari*.
8989

9090
We also partially support *Internet Explorer 11*, meaning xterm.js should work for the most part, but we reserve the right to not provide workarounds specifically for it unless it's absolutely necessary to get the basic input/output flow working.
9191

92-
Xterm.js works seamlessly in [Electron](https://electronjs.org/) apps and may even work on earlier versions of the browsers, these are the versions we strive to keep working.
92+
Xterm.js works seamlessly in [Electron](https://electronjs.org/) apps and may even work on earlier versions of the browsers. These are the versions we strive to keep working.
9393

9494
## API
9595

9696
The full API for xterm.js is contained within the [TypeScript declaration file](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts), use the branch/tag picker in GitHub (`w`) to navigate to the correct version of the API.
9797

98-
Note that some APIs are marked *experimental*, these are added to enable experimentation with new ideas without committing to support it like a normal [semver](https://semver.org/) API. Note that these APIs can change radically between versions so be sure to read release notes if you plan on using experimental APIs.
98+
Note that some APIs are marked *experimental*, these are added to enable experimentation with new ideas without committing to support it like a normal [semver](https://semver.org/) API. Note that these APIs can change radically between versions, so be sure to read release notes if you plan on using experimental APIs.
9999

100100
## Real-world uses
101101
Xterm.js is used in several world-class applications to provide great terminal experiences.
102102

103103
- [**SourceLair**](https://www.sourcelair.com/): In-browser IDE that provides its users with fully-featured Linux terminals based on xterm.js.
104-
- [**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.
104+
- [**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.
105105
- [**ttyd**](https://github.com/tsl0922/ttyd): A command-line tool for sharing terminal over the web, with fully-featured terminal emulation based on xterm.js.
106106
- [**Katacoda**](https://www.katacoda.com/): Katacoda is an Interactive Learning Platform for software developers, covering the latest Cloud Native technologies.
107107
- [**Eclipse Che**](http://www.eclipse.org/che): Developer workspace server, cloud IDE, and Eclipse next-generation IDE.
@@ -113,10 +113,10 @@ Xterm.js is used in several world-class applications to provide great terminal e
113113
- [**Next Tech**](https://next.tech "Next Tech"): Online platform for interactive coding and web development courses. Live container-backed terminal uses xterm.js.
114114
- [**RStudio**](https://www.rstudio.com/products/RStudio "RStudio"): RStudio is an integrated development environment (IDE) for R.
115115
- [**Terminal for Atom**](https://github.com/jsmecham/atom-terminal-tab): A simple terminal for the Atom text editor.
116-
- [**Eclipse Orion**](https://orionhub.org): A modern, open source software development environment that runs in the cloud. Code, deploy and run in the cloud.
116+
- [**Eclipse Orion**](https://orionhub.org): A modern, open source software development environment that runs in the cloud. Code, deploy, and run in the cloud.
117117
- [**Gravitational Teleport**](https://github.com/gravitational/teleport): Gravitational Teleport is a modern SSH server for remotely accessing clusters of Linux servers via SSH or HTTPS.
118118
- [**Hexlet**](https://en.hexlet.io): Practical programming courses (JavaScript, PHP, Unix, databases, functional programming). A steady path from the first line of code to the first job.
119-
- [**Selenoid UI**](https://github.com/aerokube/selenoid-ui): Simple UI for the scallable golang implementation of Selenium Hub named Selenoid. We use XTerm for streaming logs over websockets from docker containers.
119+
- [**Selenoid UI**](https://github.com/aerokube/selenoid-ui): Simple UI for the scalable golang implementation of Selenium Hub named Selenoid. We use XTerm for streaming logs over websockets from docker containers.
120120
- [**Portainer**](https://portainer.io): Simple management UI for Docker.
121121
- [**SSHy**](https://github.com/stuicey/SSHy): HTML5 Based SSHv2 Web Client with E2E encryption utilising xterm.js, SJCL & websockets.
122122
- [**JupyterLab**](https://github.com/jupyterlab/jupyterlab): An extensible computational environment for Jupyter, supporting interactive data science and scientific computing across all programming languages.
@@ -167,17 +167,19 @@ Xterm.js is used in several world-class applications to provide great terminal e
167167
- [**Laravel Ssh Web Client**](https://github.com/roke22/Laravel-ssh-client): Laravel server inventory with ssh web client to connect at server using xterm.js
168168
- [**Repl.it**](https://repl.it): Collaborative browser based IDE with support for 50+ different languages.
169169
- [**TeleType**](https://github.com/akshaykmr/TeleType): cli tool that allows you to share your terminal online conveniently. Show off mad cli-fu, help a colleague, teach, or troubleshoot.
170-
- [**Intervue**](https://www.intervue.io): Pair programming for interviews. Multiple programming languages supported, with results displayed by xterm.js.
171-
- [**TRASA**](https://trasa.io): Zero trust access to Web, SSH, RDP and Database services.
170+
- [**Intervue**](https://www.intervue.io): Pair programming for interviews. Multiple programming languages are supported, with results displayed by xterm.js.
171+
- [**TRASA**](https://trasa.io): Zero trust access to Web, SSH, RDP, and Database services.
172172
- [**Commas**](https://github.com/CyanSalt/commas): Commas is a hackable terminal and command runner.
173173
- [**Devtron**](https://github.com/devtron-labs/devtron): Software Delivery Workflow For Kubernetes.
174174
- [**NxShell**](https://github.com/nxshell/nxshell): An easy to use new terminal for SSH.
175175
- [**gifcast**](https://dstein64.github.io/gifcast/): Converts an asciinema cast to an animated GIF.
176-
- [**WizardWebssh**](https://gitlab.com/mikeramsey/wizardwebssh): A terminal with Pyqt5 Widget for embedding which can be used as an ssh client to connect to your ssh servers. It is written in Python, based on tornado, paramiko and xterm.js.
177-
- [**Wizard Assistant**](https://wizardassistant.com/): Wizard Assistant comes with advanced automation tools, preloaded common and special time-saving commands, and a built in SSH terminal. Now you can remotely administer, troubleshoot, and analyze any system with ease.
178-
[And much more...](https://github.com/xtermjs/xterm.js/network/dependents)
176+
- [**WizardWebssh**](https://gitlab.com/mikeramsey/wizardwebssh): A terminal with Pyqt5 Widget for embedding, which can be used as an ssh client to connect to your ssh servers. It is written in Python, based on tornado, paramiko, and xterm.js.
177+
- [**Wizard Assistant**](https://wizardassistant.com/): Wizard Assistant comes with advanced automation tools, preloaded common and special time-saving commands, and a built-in SSH terminal. Now you can remotely administer, troubleshoot, and analyze any system with ease.
178+
- [**ucli**](https://github.com/tsadarsh/ucli): Command Line for everyone :family_man_woman_girl_boy: at [www.ucli.tech](https://www.ucli.tech).
179+
- [**Tess**](https://github.com/SquitchYT/Tess/): Simple Terminal Fully Customizable for Everyone.
180+
- [And much more...](https://github.com/xtermjs/xterm.js/network/dependents)
179181

180-
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. Note: Please add any new contributions to the end of the list only.
182+
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 on our list. Note: Please add any new contributions to the end of the list only.
181183

182184
## Releases
183185

@@ -187,21 +189,21 @@ All current and past releases are available on this repo's [Releases page](https
187189

188190
### Beta builds
189191

190-
Our CI releases beta builds to npm for every change that goes into master, install the latest beta build with:
192+
Our CI releases beta builds to npm for every change that goes into master. Install the latest beta build with:
191193

192-
```
194+
```bash
193195
npm install -S xterm@beta
194196
```
195197

196-
These should generally be stable but some bugs may slip in, we recommend using the beta build primarily to test out new features and for verifying bug fixes.
198+
These should generally be stable, but some bugs may slip in. We recommend using the beta build primarily to test out new features and to verify bug fixes.
197199

198200
## Contributing
199201

200-
You can read the [guide on the wiki](https://github.com/xtermjs/xterm.js/wiki/Contributing) to learn how to contribute and setup xterm.js for development.
202+
You can read the [guide on the wiki](https://github.com/xtermjs/xterm.js/wiki/Contributing) to learn how to contribute and set up xterm.js for development.
201203

202204
## License Agreement
203205

204-
If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.
206+
If you contribute code to this project, you implicitly allow your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.
205207

206208
Copyright (c) 2017-2019, [The xterm.js authors](https://github.com/xtermjs/xterm.js/graphs/contributors) (MIT License)<br>
207209
Copyright (c) 2014-2017, SourceLair, Private Company ([www.sourcelair.com](https://www.sourcelair.com/home)) (MIT License)<br>

addons/xterm-addon-attach/src/AttachAddon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class AttachAddon implements ITerminalAddon {
2020
this._socket = socket;
2121
// always set binary type to arraybuffer, we do not handle blobs
2222
this._socket.binaryType = 'arraybuffer';
23-
this._bidirectional = (options && options.bidirectional === false) ? false : true;
23+
this._bidirectional = !(options && options.bidirectional === false);
2424
}
2525

2626
public activate(terminal: Terminal): void {

addons/xterm-addon-ligatures/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xterm-addon-ligatures",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Add support for programming ligatures to xterm.js",
55
"author": {
66
"name": "The xterm.js authors",

addons/xterm-addon-ligatures/src/font.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ interface IFontMetadata {
1515
blob: () => Promise<Blob>;
1616
}
1717

18+
interface IFontAccessNavigator {
19+
fonts: {
20+
query: () => Promise<IFontMetadata[]>;
21+
};
22+
permissions: {
23+
request?: (permission: { name: string }) => Promise<{state: string}>;
24+
};
25+
}
26+
1827
let fontsPromise: Promise<FontList | Record<string, IFontMetadata[]>> | undefined = undefined;
1928

2029
/**
@@ -28,7 +37,7 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
2837
// Web environment that supports font access API
2938
if (typeof navigator !== 'undefined' && 'fonts' in navigator) {
3039
try {
31-
const status = await (navigator as any).permissions.request?.({
40+
const status = await (navigator as IFontAccessNavigator).permissions.request?.({
3241
name: 'local-fonts'
3342
});
3443
if (status && status.state !== 'granted') {
@@ -44,8 +53,8 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
4453
}
4554
const fonts: Record<string, IFontMetadata[]> = {};
4655
try {
47-
const fontsIterator: AsyncIterableIterator<IFontMetadata> = (navigator as any).fonts.query();
48-
for await (const metadata of fontsIterator) {
56+
const fontsIterator = await (navigator as IFontAccessNavigator).fonts.query();
57+
for (const metadata of fontsIterator) {
4958
if (!fonts.hasOwnProperty(metadata.family)) {
5059
fonts[metadata.family] = [];
5160
}

addons/xterm-addon-ligatures/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ lodash.get@^4.4.2:
128128
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
129129

130130
lodash@^4.17.15:
131-
version "4.17.19"
132-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
133-
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
131+
version "4.17.21"
132+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
133+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
134134

135135
lolex@^2.7.5:
136136
version "2.7.5"

addons/xterm-addon-search/src/SearchAddon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export class SearchAddon implements ITerminalAddon {
394394
// If it is not in the viewport then we scroll else it just gets selected
395395
if (result.row >= (terminal.buffer.active.viewportY + terminal.rows) || result.row < terminal.buffer.active.viewportY) {
396396
let scroll = result.row - terminal.buffer.active.viewportY;
397-
scroll = scroll - Math.floor(terminal.rows / 2);
397+
scroll -= Math.floor(terminal.rows / 2);
398398
terminal.scrollLines(scroll);
399399
}
400400
return true;

addons/xterm-addon-serialize/benchmark/SerializeAddon.benchmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ perfContext('Terminal: sh -c "dd if=/dev/urandom count=40 bs=1k | hexdump | lolc
3535
chunks.push(data as unknown as Buffer);
3636
length += data.length;
3737
});
38-
await new Promise(resolve => p.on('exit', () => resolve()));
38+
await new Promise<void>(resolve => p.on('exit', () => resolve()));
3939
contentUtf8 = Buffer.concat(chunks, length);
4040
// translate to content string
4141
const buffer = new Uint32Array(contentUtf8.length);

0 commit comments

Comments
 (0)