Xterm.js: `entry.intersectionRatio` is not exactly 1.0

Created on 9 Sep 2020  路  9Comments  路  Source: xtermjs/xterm.js

Details

  • Browser and browser version: Electron 6
  • OS version: Win 10
  • xterm.js version: 4.9.0

Steps to reproduce

We hit a strange bug that was blocking us for a couple of days. Until we found the intersectionRatio is sometimes near to 1.0 (like 0.99) but not exactly 1.0.

https://github.com/atom-ide-community/terminal/issues/5#issuecomment-689720693
https://github.com/atom-ide-community/terminal/issues/5

I just wanted to let you know about this behavior.

We had a condition to create xterm Element only if intersectionRatio === 1.0 which was not being triggered (this condition was to avoid https://github.com/bus-stop/x-terminal/issues/57).

Suggestion

Introduce a boolean value that shows if the intersectionRatio is almost 1.

typquestion

Most helpful comment

I feel like fit being called on a hidden element or one with 0 width or height shouldn't throw an error. It should just check for that situation and return early without doing anything. I can't see a situation where that would be a problem.

All 9 comments

This is probably a bug in chrome not xterm.

Where can we report this bug? Should it be chromium? https://chromium.googlesource.com/chromium/src/

We solved it by a workaround, but this is a xterm issue. xterm should not allow the following error:
https://github.com/bus-stop/x-terminal/issues/57#issuecomment-664674538

That error comes from the fit addon. Running fit when the canvas that has a 0 width or height will throw the error Uncaught Error: This API only accepts integers

We could handle that better but in the end the right behavior is probably still throw, just with a better message about NaN terminal dimensions.

I feel like fit being called on a hidden element or one with 0 width or height shouldn't throw an error. It should just check for that situation and return early without doing anything. I can't see a situation where that would be a problem.

It already seems to do something similar if the terminal isn't connected to the dom

https://github.com/xtermjs/xterm.js/blob/4e18a78c02d0bcb5b97eeeb741d5e3c0b996cdc3/addons/xterm-addon-fit/src/FitAddon.ts#L36-L38

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jerch picture jerch  路  3Comments

tandatle picture tandatle  路  3Comments

Tyriar picture Tyriar  路  4Comments

LB-J picture LB-J  路  3Comments

fabiospampinato picture fabiospampinato  路  4Comments