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).
Introduce a boolean value that shows if the intersectionRatio is almost 1.
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/
There seems to exist a isIntersecting property:
https://github.com/xtermjs/xterm.js/blob/b89d4b102e13ad0521097e8f0fb5d3b89910a494/src/browser/services/RenderService.ts#L89
But seems to have its own issues: https://github.com/xtermjs/xterm.js/issues/2998#issuecomment-656875304
Looks like you've already fixed it, no?
https://github.com/atom-ide-community/terminal/commit/7a0545149fc5d5917a322bd06f9f9af7a5308717
We only care if it's partially visible (entry.intersectionRatio === 0):
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
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.