mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-26 03:51:49 +03:00
Fix code from xterm-addon-fit so that we don't run into issues with the first recovered console.. I'm sure there's a better way.
This commit is contained in:
parent
6a9d569345
commit
5679d5edf1
@ -85,8 +85,21 @@ export class XTermFrontend extends Frontend {
|
||||
|
||||
this.resizeHandler = () => {
|
||||
try {
|
||||
if (getComputedStyle(this.xtermCore.element).getPropertyValue('height') !== 'auto') {
|
||||
this.fitAddon.fit()
|
||||
if (this.xtermCore.element && getComputedStyle(this.xtermCore.element).getPropertyValue('height') !== 'auto') {
|
||||
|
||||
let t = window.getComputedStyle(this.xtermCore.element.parentElement)
|
||||
let r = parseInt(t.getPropertyValue("height"))
|
||||
let n = Math.max(0, parseInt(t.getPropertyValue("width")))
|
||||
let o = window.getComputedStyle(this.xtermCore.element)
|
||||
let i = r - (parseInt(o.getPropertyValue("padding-top")) + parseInt(o.getPropertyValue("padding-bottom")))
|
||||
let l = n - (parseInt(o.getPropertyValue("padding-right")) + parseInt(o.getPropertyValue("padding-left"))) - this.xtermCore.viewport.scrollBarWidth
|
||||
let actualCellWidth = this.xtermCore._renderService.dimensions.actualCellWidth || 9;
|
||||
let actualCellHeight = this.xtermCore._renderService.dimensions.actualCellHeight || 17;
|
||||
let cols = Math.floor(l / actualCellWidth)
|
||||
let rows = Math.floor(i / actualCellHeight);
|
||||
|
||||
console.log("resizing to: ", cols, rows);
|
||||
this.xterm.resize(cols, rows);
|
||||
}
|
||||
} catch (e) {
|
||||
// tends to throw when element wasn't shown yet
|
||||
|
Loading…
Reference in New Issue
Block a user