Xterm.js: Certain escape sequences in quick succession break rendering.

Created on 24 May 2019  路  5Comments  路  Source: xtermjs/xterm.js

Details

  • Browser and browser version: Chrome Latest
  • OS version: Linux
  • xterm.js version: 3.13.2

Steps to reproduce

If you take the following escape sequences and run them in a fast loop nothing is rendered in the end.

      const lines = [
        '\u001b\u0063',
        '\u001b\u005d\u0030\u003b\u0020\u0007',
        '\u001b\u005b\u0048\u001b\u005b\u0032\u004a\u001b\u005b\u0031\u003b\u0033\u0033\u006d',
        'test test test',
        'lalala',
      ];
      for (let line of lines) {
        this.terminal.write(line);
      }

But if you make them run as a microtask it renders fine:

      var inter;
      inter = setInterval(
        () => (lines.length ? this.terminal.write(lines.shift()) : clearInterval(inter)),
        0
      );

The same script that contains these escape codes is run daily with thousands of users and it displays fine using an older version of xterm.js.

typbug

Most helpful comment

@jerch Good news! It definitely fixes it.

All 5 comments

@agronick Can repro it, seems RIS wrongly recreates the write buffers as well forgetting stuff behind.

Thanks for taking care of that so quick. You guys are awesome. Any idea when it will hit NPM?

Prolly with the next release around first week in June. Care to test if https://github.com/xtermjs/xterm.js/pull/2127 solves the issue for you? Because that code was not touched for 2 years, you either were on a really old version or its not the right fix yet. (at least works with the data you gave in the issue description)

I just got home for the long weekend and I won't have access until Tuesday. I'll be sure to test it then. It is possible we are on an old version.

It is also possible we have the issue in production but most servers don't output fast enough to cause the issue. Or that the users are seeing it but never reported it. Maybe they open and close the terminal until they get lucky and it works. I've never heard anyone mention it.

@jerch Good news! It definitely fixes it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tyriar picture Tyriar  路  4Comments

jestapinski picture jestapinski  路  3Comments

tandatle picture tandatle  路  3Comments

zhangjie2012 picture zhangjie2012  路  3Comments

goxr3plus picture goxr3plus  路  3Comments