mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-27 06:49:53 +00:00
fixed scrollbar positioning on resize - fixes #4854
This commit is contained in:
parent
da089fc46a
commit
f820a2a631
@ -118,20 +118,8 @@ export class XTermFrontend extends Frontend {
|
|||||||
this.resizeHandler = () => {
|
this.resizeHandler = () => {
|
||||||
try {
|
try {
|
||||||
if (this.xterm.element && getComputedStyle(this.xterm.element).getPropertyValue('height') !== 'auto') {
|
if (this.xterm.element && getComputedStyle(this.xterm.element).getPropertyValue('height') !== 'auto') {
|
||||||
const t = window.getComputedStyle(this.xterm.element.parentElement!)
|
this.fitAddon.fit()
|
||||||
const r = parseInt(t.getPropertyValue('height'))
|
this.xtermCore.viewport._refresh()
|
||||||
const n = Math.max(0, parseInt(t.getPropertyValue('width')))
|
|
||||||
const o = window.getComputedStyle(this.xterm.element)
|
|
||||||
const i = r - (parseInt(o.getPropertyValue('padding-top')) + parseInt(o.getPropertyValue('padding-bottom')))
|
|
||||||
const l = n - (parseInt(o.getPropertyValue('padding-right')) + parseInt(o.getPropertyValue('padding-left'))) - this.xtermCore.viewport.scrollBarWidth
|
|
||||||
const actualCellWidth = this.xtermCore._renderService.dimensions.actualCellWidth || 9
|
|
||||||
const actualCellHeight = this.xtermCore._renderService.dimensions.actualCellHeight || 17
|
|
||||||
const cols = Math.floor(l / actualCellWidth)
|
|
||||||
const rows = Math.floor(i / actualCellHeight)
|
|
||||||
|
|
||||||
if (!isNaN(cols) && !isNaN(rows)) {
|
|
||||||
this.xterm.resize(cols, rows)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// tends to throw when element wasn't shown yet
|
// tends to throw when element wasn't shown yet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user