Merge branch 'pr/1249'

This commit is contained in:
Eugene Pankov
2019-08-07 15:10:19 +02:00
9 changed files with 57 additions and 24 deletions

View File

@@ -86,7 +86,18 @@ export class XTermFrontend extends Frontend {
this.resizeHandler = () => {
try {
if (this.xtermCore.element && getComputedStyle(this.xtermCore.element).getPropertyValue('height') !== 'auto') {
this.fitAddon.fit()
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);
this.xterm.resize(cols, rows);
}
} catch (e) {
// tends to throw when element wasn't shown yet

View File

@@ -156,9 +156,17 @@ export default class TerminalModule { // eslint-disable-line @typescript-eslint/
}
})
if (config.store.terminal.autoOpen) {
app.ready$.subscribe(() => {
terminal.openTab()
})
let argv = require('electron').remote.process.argv;
if (argv[0].includes('node')) {
argv = argv.slice(1)
}
if(require('yargs').parse(argv.slice(1))._[0] !== "open"){
app.ready$.subscribe(() => {
terminal.openTab()
})
}
}
hotkeys.matchedHotkey.subscribe(async (hotkey) => {