Announcing xterm.js 2.3

Today we are announcing xterm.js 2.3! Below you can find some of the most important updates of this release.

Performance

The speed of xterm.js has been improved significantly this release due to optimizations in buffer management, the parser and the renderer. You should expect to see a responable framerate even when the commands generate a lot of output. Commands also typically run around 5 times faster.

Performance demo

Buffer management

Previously when the terminal’s buffer was filled it would be chopped in half to make room for more data, this is why there was some quirky behavior with the scroll bar when a lot of output was processed. Now the buffer is managed in a circular list which makes it faster from both a memory and CPU perspective.

A bonus that came from this is that scroll events are no longer fired on every new line when the buffer is full since no scroll actually happens anymore since the viewport stays in the same position.

Renderer optimizations

The renderer saw huge improvements. All DOM interactions are now performed asynchronously in animation frames, meaning the DOM will only be updated at most 60 times per second (most browsers). Additional frame skipping is also used to skip frames when the renderer knows more writes are pending in the write queue, this saves CPU cycles that could be better used by the parser. Other improvements:

  • Minimizing forced layouts by limiting usage of things like getBoundingClientRect.
  • Added experimental flow control support via the useFlowControl option which will allow xterm.js to tell the pty to pause (XOFF signal) and resume (XON signal). When this is enabled ctrl+c (SIGINT) should be more responsive and commands like time should be more accurate as xterm.js and the backing pty are synced. Note that this is disabled by default and shell support appears to be limited outside of bash.

Parser optimizations

Parsing is now performed in chunks and asynchronously instead of all at once synchronously, this means no more parser-based lock ups. The parser itself was also optimized by converting the majority of the switch statements (O(n)) to be instead driven by maps (O(1)).

xterm compatibility

Cursor style support

The underline and bar cursor type are now supported, these can also be set using the CSI sequence to set the cursor style.

Cursor styles

VT100 character sets

All VT100 national replacement character sets (NRC sets) are now supported: British, Dutch, Finnish, French, French Canadian, German, Italian, Norwegian/Danish, Spanish, Swedish and Swiss.

Flow control

^S (XOFF) and ^Q (XON) are now correctly handled by xterm.js, allowing them to trigger pause and resume.

TypeScript conversion

Big strides were made in the TypeScript conversion this release with approximately 2/3 of the xterm.js now living as TypeScript files.

Other stuff

Here are the other features added this release:

  • alt+left/right now skips words on Mac.
  • New disableStdin option that will completely disable all input handling.
  • New tabStopWidth option to customize the size of tabs.

Check out the GitHub release for bug fixes and a complete list of changes in this release.

A big thank you to our contributors!

As always, this release would not have been possible without the contribution of our amazing contributors.

We would like to thank and credit all of external contributors for their work on xterm.js:

Xterm.js 2.3 is available on npm, bower and GitHub Releases as usual, so go get it and start creating amazing terminal apps now!