How to use the xterm/lib/addons/fit/fit.proposeGeometry function in xterm

To help you get started, weโ€™ve selected a few xterm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / terminal / src / browser / terminal-widget-impl.ts View on Github external
protected resizeTerminal(): void {
        const geo = proposeGeometry(this.term);
        const cols = geo.cols;
        const rows = geo.rows - 1; // subtract one row for margin
        this.term.resize(cols, rows);
    }
github patternfly / patternfly-react / packages / react-console / src / SerialConsole / XTerm.js View on Github external
componentWillUpdate(nextProps, nextState) {
    if (
      nextState.cols !== this.state.cols ||
      nextState.rows !== this.state.rows ||
      nextState.autoFit !== this.state.autoFit
    ) {
      if (nextState.autoFit) {
        // If it is autoFit, get the computed size and set it
        this.removeMinWidth();
        const geometry = proposeGeometry(this.state.terminal);
        this.state.terminal.resize(geometry.cols, geometry.rows);
        this.props.onResize(geometry.rows, geometry.cols);
      } else {
        this.addMinWidth(nextState.cols);
        this.state.terminal.resize(nextState.cols, nextState.rows);
        this.props.onResize(nextState.rows, nextState.cols);
      }
    }
  }
github moonrailgun / devbox / src / renderer / components / Deprecated / SSHEmulator.vue View on Github external
resize () {
        if (this.term) {
          let { cols, rows } = fit.proposeGeometry(this.term)
          this.term.fit()
          this.ptyProcess && this.ptyProcess.resize(cols, rows)
        } else {
          console.warn('no term!')
        }
      },
      init () {
github cncjs / cncjs / src / app / widgets / Console / Terminal.jsx View on Github external
resize(cols = this.props.cols, rows = this.props.rows) {
        if (!(this.term && this.term.element)) {
            return;
        }

        const geometry = fit.proposeGeometry(this.term);
        if (!geometry) {
            return;
        }

        cols = (!cols || cols === 'auto') ? geometry.cols : cols;
        rows = (!rows || rows === 'auto') ? geometry.rows : rows;
        this.term.resize(cols, rows);
    }
github patternfly / patternfly-react / packages / react-console / src / SerialConsole / XTerm.js View on Github external
onWindowResize() {
    if (this.state.autoFit) {
      this.removeMinWidth();
      const geometry = proposeGeometry(this.state.terminal);
      if (geometry) {
        this.setState({
          rows: geometry.rows,
          cols: geometry.cols
        });
      }
    } else {
      this.addMinWidth(this.state.cols);
    }
  }
github cncjs / cncjs / src / web / widgets / Console / Terminal.jsx View on Github external
resize(cols = this.props.cols, rows = this.props.rows) {
        if (!(this.term && this.term.element)) {
            return;
        }

        const geometry = fit.proposeGeometry(this.term);
        if (!geometry) {
            return;
        }

        cols = (!cols || cols === 'auto') ? geometry.cols : cols;
        rows = (!rows || rows === 'auto') ? geometry.rows : rows;
        this.term.resize(cols, rows);
    }
    clear() {