Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes terminal wrapping by syncing docker/term.js terminal widths. #1648

Merged
merged 1 commit into from
Jul 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions client/app/scripts/components/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ class Terminal extends React.Component {

handleResize() {
const innerNode = ReactDOM.findDOMNode(this.innerFlex);
const width = innerNode.clientWidth - (2 * 8);
const height = innerNode.clientHeight - (2 * 8);
const cols = Math.floor(width / this.state.pixelPerCol);
const cols = DEFAULT_COLS;
const rows = Math.floor(height / this.state.pixelPerRow);

this.setState({cols, rows});
}

Expand Down Expand Up @@ -304,8 +304,12 @@ class Terminal extends React.Component {
}

render() {
const innerFlexStyle = {
opacity: this.state.connected ? 1 : 0.8,
overflow: 'hidden',
};
const innerStyle = {
opacity: this.state.connected ? 1 : 0.8
width: (this.state.cols + 2) * this.state.pixelPerCol
};
const innerClassName = classNames('terminal-inner hideable', {
'terminal-inactive': !this.state.connected
Expand All @@ -315,8 +319,8 @@ class Terminal extends React.Component {
<div className="terminal-wrapper">
{this.isEmbedded() && this.getTerminalHeader()}
<div ref={(ref) => this.innerFlex = ref}
className={innerClassName} style={innerStyle} >
<div ref={(ref) => this.inner = ref} />
className={innerClassName} style={innerFlexStyle} >
<div style={innerStyle} ref={(ref) => this.inner = ref} />
</div>
{this.getTerminalStatusBar()}
</div>
Expand Down