diff --git a/lib/components/term.js b/lib/components/term.js index 8b31a59d..a349efc4 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -1,12 +1,15 @@ /* global Blob,URL,requestAnimationFrame */ import React from 'react'; import {Terminal} from 'xterm'; +import * as fit from 'xterm/lib/addons/fit/fit'; import {clipboard} from 'electron'; import * as Color from 'color'; import {PureComponent} from '../base-components'; import terms from '../terms'; import processClipboard from '../utils/paste'; +Terminal.applyAddon(fit); + // map old hterm constants to xterm.js const CURSOR_STYLES = { BEAM: 'bar', @@ -195,10 +198,7 @@ export default class Term extends PureComponent { if (!this.termWrapperRef) { return; } - const termRect = this.termWrapperRef.getBoundingClientRect(); - const cols = Math.floor(termRect.width / this.term.charMeasure.width); - const rows = Math.floor(termRect.height / this.term.charMeasure.height); - this.resize(cols, rows); + this.term.fit(); } keyboardHandler(e) { @@ -286,7 +286,7 @@ export default class Term extends PureComponent { > {this.props.customChildrenBefore}
-
+
{this.props.customChildren}