-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto fit addon doesn't work when parent element uses border-box #1283
Comments
@cancan101 Are you sure it's failing on |
It's for border-box. Suppose you have an element with If we have If we have Instead it needs to be client height minus padding to account for this (I think, unless there's a more direct way to read content height). |
Open to PRs, you can repro this in the demo by adding |
This bug just hit me again but this time I decided to actually investigate the reason and found this issue. This issue may be fixed / worked around with using one of two different approaches:
At the very least it should be documented here https://xtermjs.org/docs/api/addons/fit/ |
This appears to be due to the interplay of the padding on the #xterm element and the box-sizing of the #terminal-container element being set to border-box. This issue in the xterm.js repository talks about the same thing: xtermjs/xterm.js#1283 The workaround mentioned in the issue appears to solve the problem here. That is, set the box-sizing on the #terminal-container to be content-box.
This appears to be due to the interplay of the padding on the #xterm element and the box-sizing of the #terminal-container element being set to border-box. This issue in the xterm.js repository talks about the same thing: xtermjs/xterm.js#1283 The workaround mentioned in the issue appears to solve the problem here. That is, set the box-sizing on the #terminal-container to be content-box.
This appears to be due to the interplay of the padding on the #xterm element and the box-sizing of the #terminal-container element being set to border-box. This issue in the xterm.js repository talks about the same thing: xtermjs/xterm.js#1283 The workaround mentioned in the issue appears to solve the problem here. That is, set the box-sizing on the #terminal-container to be content-box.
This appears to be due to the interplay of the padding on the #xterm element and the box-sizing of the #terminal-container element being set to border-box. This issue in the xterm.js repository talks about the same thing: xtermjs/xterm.js#1283 The workaround mentioned in the issue appears to solve the problem here. That is, set the box-sizing on the #terminal-container to be content-box.
The calculations for height and width of the parent in the auto fit plugin are incorrect when the parent element uses
box-sizing: border-box
. This is because the computed height includes the padding but the content does not.The right implementation might be to get the client height of the parent element using gBCR and then subtract the parent padding.
/CC @taion
The text was updated successfully, but these errors were encountered: