Skip to content

5.0.0

Compare
Choose a tag to compare
@Tyriar Tyriar released this 15 Sep 20:00
· 1675 commits to master since this release
904ddff

v5 is here! This is our largest release in a long time, maybe ever πŸ‘€

Since this was a major version bump, we used the opportunity to clean up the API and make other breaking changes. Many of these changes enabled a significant reduction in the xterm module bundle size which went from 379kb to 265kb for a 30% reduction!

πŸš€ Features

Underline style and color support (#3921, #3976, #3980, #4053, #4068, #4074, #4077, #4109) via @Tyriar

Underline style and color sequences such as CSI 4:2m ST for double underlines are now supported:

image

Some work was also done to improve underline rendering overall, characters with long descenders don't overlap with the underline:

image

Hyperlink escape sequence support (#4005, #4087, #4088) via @Tyriar, @jerch

Building upon the improved underline rendering, hyperlink escapes outlined in this gist are now supported. They will be rendered using a dashed underline (like CSI 4:5m ST):

image

Along with this is a new linkHandler option which allows controling hover, leave and activate events, for example to show a custom tooltip. VS Code's implementation looks like this:

image

Smooth scroll support (#3940) via @Tyriar

The new smoothScrollDuration allows setting a duration in milliseconds to animate scroll between the origin and target positions. This is most useful when using a physical mouse (not a trackpad) to help not disorient the user when scrolling with the mouse wheel.

Canvas renderer addon (#3949, #3950, #3954, #3959, #3961, #3981) via @Tyriar

The canvas renderer has moved into an addon, significantly reducing the bundle size of the xterm module. This used to be the default renderer and is now recommended only as a fallback to the webgl addon if that does not work for some reason (eg. no webgl2 support).

New VT feature support (#4093, #4095, #4098)via @jerch

xterm.js handles several new VT sequences:

  • SGR-pixels mouse reports support (#4093) via @jerch
  • DECRQM support - ANSI and DEC private mode reporting (#4095) via @jerch
  • Protection flag support (#4098) via @jerch

Other features

  • Powerline semi-circle glyphs are now custom rendered (#3891) via @sbatten
  • Inactive selection background (#3965) via @Tyriar - ITheme.selectionInactiveBackground will now change the selection color when the terminal is not focused
  • Support setting extended ansi colors 16-255 (#3905, #3909) via @silamon, @Tyriar
  • The parser and buffer APIs are now stable (#3951) via @Tyriar
  • Rendering should now work when opening xterm.js in a popout window (#4069) via @mihaip

🐞 Bug fixes

  • Fix an exception when markers are deleted (#3888, #3901) via @Tyriar
  • Make corner box glyphs uniformly round (#3895) via @Tyriar
  • Fix changing allowTransparency from its initial value in the Terminal constructor (#3899) via @Tyriar
  • Throw when setting an invalid cursorStyle (#3900) via @Tyriar
  • Allow markers in the alt buffer (#3924) via @silamon
  • Retain hue when minimum contrast ratio flips luminance (#3929) via @Tyriar
  • Remove shift+backspace -> ^H binding (#3935) via @Tyriar
  • Fix disabling the webgl addon in the demo (#3988) via @Tyriar
  • Improve deletion handling on Android (#4007) via @ink404
  • Fix performance regression introduced with decoration support (#4080) via @Tyriar

πŸ“ Documentation and internal improvements

πŸ›‘ Breaking changes

  • bellSound and bellStyle options as well as the previously builtin sound have been removed (#3941) via @Tyriar. This reduces the bundle size while still allowing the embedder to support the terminal bell via the Terminal.onBell API

    // before 5.0.0
    term = new Terminal({
      bellStyle: 'sound'
    });
    
    // after 5.0.0
    term = new Terminal();
    term.onBell(() => {
      // Play a sound
    });
  • The link matcher API registerLinkMatcher and deregisterLinkMatcher have been removed in favor of the link provider API (#3944) via @Tyriar.

  • The allowProposedApi option now defaults to false, set this to true to opt-in to proposed API usage if you understand the implications (#3945) via @Tyriar

    // before 5.0.0
    term = new Terminal({});
    term.someProposedApi();
    
    // after 5.0.0
    term = new Terminal({
      allowProposedApi: true
    });
    term.someProposedApi();
  • The deprecated addMarker API has been removed in favor of registerMarker (#3946) via @Tyriar. They are functionally equivalent.

  • The deprecated getOption and setOption APIs have been removed in favor of options (#3947) via @Tyriar

    // before 5.0.0
    term.setOption('scrollback', 1000);
    console.log(term.getOption('scrollback'));
    
    // after 5.0.0
    term.options.scrollback = 1000;
    console.log(term.options.scrollback);
  • The deprecated writeUtf8 API has been removed in favor of write (#3947) via @Tyriar.

    const arr = new Uint8Array(10);
    
    // before 5.0.0
    term.writeUtf8(arr);
    
    // after 5.0.0
    term.write(arr);
  • ISelectionPosition have been removed from the API in favor of IBufferRange (#3952) via @Tyriar

  • cols and rows options can now only be set in the constructor (#3960, #3972, #4078) via @Tyriar, @silamon

    // before 5.0.0
    term.setOption('cols', 10);
    
    // after 5.0.0
    term.resize(10, term.rows);
  • ITheme.selection has been renamed to selectionBackground for consistency (#3964) via @Tyriar

    // before 5.0.0
    term.options.theme = { selection: '#000000' };
    
    // after 5.0.0
    term.options.theme = { selectionBackground: '#000000' };
  • The Terminal.options getter now returns a Required<ITerminalOptions> instead of just ITerminalOptions for better correctness. Along with this change fastScrollModifier now accepts 'none' instead of undefined

    // before 5.0.0
    new Terminal({ fastScrollModifier: undefined });
    
    // after 5.0.0
    new Terminal({ fastScrollModifier: 'none' });

πŸŽ‰ New real-world use cases


πŸ“₯ Addons

xterm-addon-canvas

  • Redraw selection on resize (#3938) via @Tyriar
  • Fix rendering of the β–› (U+259B) character (#3902) via @Tyriar
  • Fix blurry rendering that could happen when using a non-round devicePixelRatio (#3926, #4009, #4105) via @Tyriar, @jeanp413
  • Overdraw powerline strokes such that the top and bottom are flat against the cell boundaries (#4070) via @Tyriar
  • Show entire glyph for extra powerline symbols (#4073, #4086) via @Tyriar

xterm-addon-fit

  • Fix return type of proposeDimensions to include undefined (#3882) via @jerch

xterm-addon-ligatures

  • Warn when ligature fonts fail to download (#3933) via @Tyriar
  • Fix the addon in the latest version of Chrome (#3936) via @Tyriar
  • Fallback ligatures are now supported, allowing ligatures to work without font access (#3963) via @Tyriar
  • Remove electron renderer and node targets (#4002, #4003) via @Tyriar

xterm-addon-web-links

  • The link matcher-based implementation has been removed in favor of the link provider implementation (#3944) via @Tyriar

xterm-addon-webgl

More efficient GPU memory usage using new texture atlas packing strategy (#3979) via @Tyriar

The previous naive texture packing strategy which only allowed adding to the "active row" or below has been replaced with a new strategy that uses multiple active rows and adds glyphs to the most suitable row based on its pixel height. This leads to more effective usage of the texture xterm.js uploads to the GPU, meaning it's harder to reset the texture when it becomes filled (which is more likely to happen when screen scale is high).

Before:

image

After:

image

Other changes

  • Release webgl resources when the addon is disposed (#3890) via @Tyriar
  • Clip pixels to the left of a cell when the background color changes, preventing pixels overflowing (#3896) via @Tyriar
  • Clear glyph pixels when all channels differ below some threshold (#3897) via @Tyriar
  • Fix rendering of the β–› (U+259B) character (#3902) via @Tyriar
  • Fix blurry rendering that could happen when using a non-round devicePixelRatio (#3926, #4009, #4105) via @Tyriar, @jeanp413
  • Fix dim rendering edge cases (#3973, #3989) via @Tyriar
  • Fix powerline and other custom glyph offsets and support letter spacing (#3985, #4085) via @Tyriar
  • Polish powerline rendering so the middle of the stroke won't be cut off (#3987) via @Tyriar
  • Overdraw powerline strokes such that the top and bottom are flat against the cell boundaries (#4070) via @Tyriar
  • Show entire glyph for extra powerline symbols (#4073, #4086) via @Tyriar
  • Improve handling of canvas context loss (#4075) via @kenrussell
  • Fix performance regressions (#4081, #4084) via @Tyriar
  • Clear the glyph renderer when the model is cleared (#4101) via @JasonXJ
  • Fix the cursor character being drawn outside the cursor cell (#4102) via @JasonXJ

🀝 Compatible addon versions


🌐 Website