Skip to content

Releases: xtermjs/xterm.js

4.0.0

11 Sep 00:21
6211dcd
Compare
Choose a tag to compare

Finally v4 has arrived! This is our biggest release to date with 128 PRs being merged (v3 had 101). The major focuses for this version were:

  • Shipping the new addon system, including an experimental version of the WebGL renderer addon
  • Improving the build process and minifying the npm distributable
  • Making the parser to be more compatible and extensible
  • Chipping away at the new layered architecture and enabling TypeScript's strict mode
  • Removing deprecated APIs
  • Lots of bug fixes

The plan is for each new minor release to now state which addons are compatible with the library at the bottom, this might not be needed in the future but we'll evaluate that later on. We've also added a dedicated Addons section instead of mixing their updates in with the core library.


🚀 Features

New addon system

The new addon system that was introduced in 3.14.0 is now stable (#2377) via @Tyriar. This new system allows encapsulating additional functionality that leverages the xterm.js API into a module that can be shared between users of xterm.js. The API itself is extremely simple but improves over its previous incarnation with first-class TypeScript support and per-terminal lifecycle management.

export class Terminal implements IDisposable {
  /**
  * Loads an addon into this instance of xterm.js.
  * @param addon The addon to load.
  */
  loadAddon(addon: ITerminalAddon): void;
}

/**
* An addon that can provide additional functionality to the terminal.
*/
export interface ITerminalAddon extends IDisposable {
  /**
  * This is called when the addon is activated.
  */
  activate(terminal: Terminal): void;
}

Creating an addon is as simple as providing an object with the activate and dispose methods available:

class ExampleAddon {
  private _terminal: Terminal | undefined;
  activate(terminal: Terminal): void {
    this._terminal = terminal;
    console.log('activated');
  }
  dispose(): void {
    console.log('disposed');
  }
}

And used like this:

const terminal = new Terminal();
terminal.loadAddon(new ExampleAddon());
// Logs 'activated'
terminal.dispose();
// Logs 'disposed'

Addons shipped by the xterm.js team are listed at the bottom of release notes and can be installed via npm.

📦 API

  • New wordSeparator option that defines what a word boundary is when double click selecting (#2244, #2262) via @Maxris
    // Include ' and " in words
    const term = new Terminal({ wordSeparator: ' ()[]{}' });
  • New addEscHandler, addDcsHandler parser hook APIs and existing addCsiHandler and addOscHandler APIs have been refined (#2346) via @jerch
    // Do something whenever the cursor move (CUP) sequence is triggered
    term.parser.addCsiHandler({ final: 'H' }, params => doSomething(params));
    See the API documentation for more information.
  • New paste API that lets embedders pass data they want pasted directly to xterm.js (#2391) via @Tyriar. This is useful when paste isn't triggered in the typical fashion.
    term.paste(await navigator.clipboard.readText());

🐞 Bug fixes

  • Update rows after an ECH sequence, this was causing cls under ConPTY to not redraw rows sometimes (#2149) via @Tyriar
  • Correct API for IBufferCell.getCell to correctly indicate it can return undefined (#2184) via @Tyriar
  • Fix repeat preceding character sequence (REP) (#2199) via @jerch
  • Fix saved cursor position of the normal screen buffer when a resize occurs on the alternate screen buffer (#2217) via @thekondr
  • Added the style field to package.json so certain tools can locate the xterm.css file (#2221) via @blink1073
  • Fix screen DPR change not trigger a canvas refresh which caused browser zoom to leave the terminal blank (#2228) via @Tyriar
  • Lower z-index's of xterm components to avoid conflicts with embedder UIs (#2276) via @Tyriar
  • Guard against floats being used in integer-only APIs (#2277) via @Tyriar
  • Reset wrapped line status when using windowsMode (#2278) via @Maxris
  • Fix issue where you could select half of a wide character (#2283) via @lramos15
  • Fix edge cases in how we handle several sequences (#2288) via @jerch
  • Don't handle the keyup event that is handled by a custom handler (#2294) via @Tyriar
  • Rewrite mouse support from the ground up, improving compatibility and testing (#2321, #2323) via @jerch
  • Announce characters to screen readers when typing and using backspace (#2329, #2343) via @Tyriar
  • Make dispose do nothing when called a second time (#2353) via @Tyriar
  • Fix problems with scroll areas not working due to DECSTBM (#2355) via @jerch
  • Fix exception when first click is a shift+click (#2366) via @Tyriar
  • Fix cursor not changing correctly when open is called after entering mouse events mode (#2371) via @Tyriar
  • Support bubbling scroll events to parent elements when no terminal scroll happens (#2388) via @ShahzadUmair
  • Don't execute move to cell (alt+click) when the user has scrolled up (#2402) via @Tyriar
  • Fine tune when to scroll to bottom and clear selection when the onData event is emitted (#2247) via @Tyriar
  • Fix not rendering when switching from DOM to canvas renderer (#2378) via @Tyriar
  • Show text when cursor blinks in DOM renderer (#2227) via @Tyriar
  • Fix underline cursor style when blink is enabled in DOM renderer (#2374) via @Tyriar
  • Support sequences using colon and mixed colon/semi-colon notation, improving true color compatibility (#2241) via @jerch

📝 Documentation and internal improvements

🛑 Breaking changes

  • node_modules/xterm/lib/xterm.css has been moved to node_modules/xterm/css/xterm.css (#2132) via @Tyriar
  • node_modules/xterm/dist/xterm.js no longer exists and node_modules/xterm/lib/xterm.js is now minified (#2132) via @Tyriar
  • Remove the deprecated old event API (#2029) via @Tyriar
    // before 4.0.0
    term.on('data', data => console.log(data));
    
    // after 4.0.0
    term.onData(data => console.log(data));
  • Remove the deprecated destroy API (#2155) via @Tyriar
    // before 4.0.0
    term.destroy();
    
    // after 4.0.0
    term.dispose();
  • Remove the deprecated enableBold option (#2156) via @Tyriar
    // before 4.0.0
    term.setOption('enableBold', false);
    
    // after 4.0.0
    term.setOption('fontWeightBold', 'normal');
  • Remove the experimentalCharAtlas setting (#2157) via @Tyriar
    // before 4.0.0
    const term = new Terminal({ experimentalCharAtlas: 'static' });
    
    // after 4.0.0
    // No-op, the previous 'dynamic' is the only option available now due to
    // superior performance in every way.
  • Remove the blankLine localized string, this improves how screen readers announce blank lines (#2284) via @Tyriar
    // before 4.0.0
    Terminal.strings.blankLine = '<localized string>';
    
    // after 4.0.0
    // No-op
  • The old applyAddon-based addon system has been removed (#2377) via @Tyriar. New addons are installed as separate packages via npm and enabled via the non-static Terminal.loadAddon, this improved the overall lifecycle of addons as well as fix issues with typings when working with TypeScript.
    // before 4.0.0
    import { Terminal } from 'xterm';
    import * as fit from 'xterm/lib/addons/fit/fit';
    
    Terminal.applyAddon(fit);
    const terminal = new Terminal();
    terminal.fit();
    
    // after 4.0.0
    import { Terminal } from 'xterm';
    import { FitAddon } from 'xterm-addon-fit';
    
    const terminal = new Terminal();
    const fitAddon = new FitAddon();
    terminal.loadAddon(fitAddon);
    fitAddon.fit();

⚠️ Deprecations

  • We no longer explicitly support IE11, we expect the core functionality to still work but will not be going out of our way to fix optional features (#2216) via @Tyriar

🎉 New real-world use cases


📥 Addons

xterm-addon-search

  • The search result is now centered in the viewport (#2281) via @lramos15
  • Searche...
Read more

3.14.5

10 Jul 18:45
b2bb848
Compare
Choose a tag to compare

🐞 Bug fixes

  • Reset line wrapped status properly when using windowsMode (#2278) via @Maxris
  • Fix NPE when setting theme before calling Terminal.open (#2222) via @Tyriar

3.14.4

26 Jun 17:56
2a67918
Compare
Choose a tag to compare

🐞 Bug fixes

  • Fix reset (DECSTR) changing the default text style #2196

3.14.2

03 Jun 19:39
ebb2171
Compare
Choose a tag to compare

🐞 Bug fixes

  • Fix NPE when calling Terminal.open multiple times (#2179) via @Tyriar

3.14.1

31 May 16:41
Compare
Choose a tag to compare

🐞 Bug fixes

3.14.0

30 May 23:48
0ed75dc
Compare
Choose a tag to compare

📢 Our next release will be v4, read more here 👉 #2143.

Compatible new addon versions:

  • xterm-addon-fit@0.1.0-beta1

🚀 Features

📦 API

For the complete details on the new APIs, see the typings file. For APIs marked experimental we're hoping to stabilize them in v4 and want feedback from the community to make sure they are useful.

  • Support writing raw UTF-8 data directly, which may help avoid an unnecessary conversion to a relatively heavy JS string (#1904) via @jerch
    const data = new Uint8Array([102, 111, 111]);
    term.writeUtf8(data);
  • New experimental addon API (#2065, #2116) via @Tyriar
    // A simple example addon
    const addon = {
      activate: (term: Terminal) => {
        console.log('addon activated');
      },
      dispose: () => { }
    }
    term.loadAddon(addon);
  • New experimental buffer API (#2074) via @Tyriar. Consumers can finally query the textual state of the terminal.
    // Print the line that the cursor is on as text
    term.buffer.getLine(term.buffer.cursorY).translateToString(true);
  • New select and getSelectionPosition APIs (#2078) via @Tyriar
    term.select(5, 2, 10);
    console.log(term.getSelectionPosition());
    // {startColumn: 5, startRow: 2, endColumn: 15, endRow: 2}

🐞 Bug fixes

  • Add missing typings for windowsMode option (#2062) via @Tyriar
  • Improve spacing between characters in DOM renderer (#2067) via @starpit
  • Dispose of old data in the write buffer once it's been written if xterm.js hasn't caught up (#2120) via @jerch
  • Fix wrong colors printing for 256 color mode (#2125) via @jerch
  • Fix loss of data during a RIS (full reset) (#2127) via @jerch
  • Only update the accessibiltiy announcements during an animation frame (#2128) via @Tyriar
  • Fix a NPE in reflow (#2131) via @Tyriar
  • Ensure underline is rendered correctly in canvas renderer (#2134) via @Tyriar
  • Fix a font rendering issue where settings/colors wouldn't be picked up (#2140) via @Tyriar
  • webLinks addon

📝 Documentation and internal improvements

3.13.2

21 May 21:15
Compare
Choose a tag to compare

🐞 Bug fixes

3.13.1

16 May 17:33
Compare
Choose a tag to compare

🐞 Bug fixes

  • Fixes an NPE when screenReaderMode is enabled (#2085) via @Tyriar

3.13.0

16 May 14:58
ffc868a
Compare
Choose a tag to compare

🚀 Features

📦 API

  • A new and improved event API has been introduced that properly types the arguments within the listener (#2008) via @Tyriar
    Screen Shot 2019-05-08 at 7 03 49 PM
  • The new windowsMode option replaces the old winptyCompat addon (#1978, #1985, #1993) via @Tyriar, note that there are no longer the previous protections in place to prevent the mode from running on non-Windows operating systems.
  • Terminal.markers is now a ReadonlyArray (previously []) (#2036) via @Tyriar

🐞 Bug fixes

  • Prevent unhandled sequence code from being hit incorrectly (#1923) via @jerch
  • Fix UTF-8 mouse coordinate support (#1952) via @NickShaffner
  • Don't open links when selecting text and releasing the mouse in the middle of the link (#1958) via @nikonso
  • Don't do a full refresh when no needed after pausing and resuming rendering (#1976) via @Tyriar
  • No longer scroll to the xterm.js text area when it's focused (#1982) via @Tyriar
  • Fix the CSI scroll down handler (#1995) via @thekondr
  • Properly send the ^_ sequence (emacs undo) (#2052) via @jflatow
  • search addon
    • Fix skipping wrapped line results after resizing the terminal (#1866) via @ntchjb
    • Fix find next/previous not selecting correct text after resizing the terminal (#2025) @thebradbain
  • webLinks addon

📝 Documentation and internal improvements

  • Open the browser automatically when the server is ready when debugging (#1968) via @nikonso
  • Tweak rtty messaging (#1973) via @zhaojh329
  • Recommend 127.0.0.1 over 0.0.0.0 on Linux and macOS to simplify documentation (#1987) via @Tyriar
  • Fix backspace in the demo (#1997) via @Tyriar
  • Better integration with VS Code
    • Add setting for VS Code that tells TypeScript to use single quotes (#2009) via @Tyriar
    • Add build and test VS Code tasks (#2032) via @Tyriar
    • Add dev container support (#2040) via @Tyriar
  • Improving project structure
    • Build using TypeScript project references (#1984) via @Tyriar
    • Ensure DOM APIs are not used within the common and core sub-projects (#1992) via @Tyriar
    • Create a "ui" TypeScript sub-project (#2026) via @Tyriar
  • Releases

🛑 Breaking changes

  • The winptyCompat addon has been moved into core and is now enabled via the windowsMode option:
    // before 3.13.0
    import winptyCompat = require('vscode-xterm/lib/addons/winptyCompat/winptyCompat');
    Terminal.applyAddon(winptyCompat); 
    const term = new Terminal();
    
    // after 3.13.0
    const term = new Terminal({ windowsMode: true });
    See the API section for more information.

⚠️ Deprecations

  • The on, off, emit and addDisposableListener APIs are now deprecated and are planned to be removed in v4.0.0 (#2008) via @Tyriar, they are replaced with the new "explicit event API".
    // deprecated
    term.on('resize', e => doSomething(e));
    
    // recommended
    term.onResize(e => doSomething(e));
    We took this opportunity to slim down the events, cutting out some that we thought are no longer needed. If you are using any events that were not carried over to the new event API please create an issue and let us know how you're using it to see if we should expose it.

🎉 New real-world use cases


A special thanks to @Eugeny of the Terminus project for trialing the beta release and helping catch some nasty bugs before we released ❤️

3.12.2

13 Apr 05:50
Compare
Choose a tag to compare

🐞 Bug fixes