Skip to content

Commit

Permalink
Merge pull request #1988 from weaveworks/1986-safari-terminal
Browse files Browse the repository at this point in the history
Fix Safari terminal window height bug
  • Loading branch information
foot authored Nov 7, 2016
2 parents cd1e06b + 127ab41 commit 942ccc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions client/app/scripts/components/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Terminal extends React.Component {
this.handleCloseClick = this.handleCloseClick.bind(this);
this.handlePopoutTerminal = this.handlePopoutTerminal.bind(this);
this.handleResize = this.handleResize.bind(this);
this.handleResizeDebounced = _.debounce(this.handleResize, 500);
}

createWebsocket(term) {
Expand Down Expand Up @@ -204,7 +205,7 @@ class Terminal extends React.Component {

const {characterWidth, characterHeight} = terminalCellSize(this.term.element);

window.addEventListener('resize', _.debounce(this.handleResize, 500));
window.addEventListener('resize', this.handleResizeDebounced);

this.resizeTimeout = setTimeout(() => {
this.setState({
Expand All @@ -223,7 +224,7 @@ class Terminal extends React.Component {
clearTimeout(this.reconnectTimeout);
clearTimeout(this.resizeTimeout);

window.removeEventListener('resize', this.handleResize);
window.removeEventListener('resize', this.handleResizeDebounced);

if (this.term) {
log('destroy terminal');
Expand Down
11 changes: 7 additions & 4 deletions client/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -990,14 +990,17 @@ h2 {
position: relative;
// shadow of animation-wrapper is 10px, let it fit in here without being
// overflow hiddened.
padding: 10px 0 10px 10px;
flex: 1;
overflow-x: hidden;
}

&-animation-wrapper {
width: 100%;
height: 100%;
position: absolute;
// some room for the drop shadow.
top: 10px;
left: 10px;
bottom: 10px;
right: 0;
transition: transform 0.5s cubic-bezier(0.230, 1.000, 0.320, 1.000);
.shadow-2;
}
Expand Down Expand Up @@ -1063,7 +1066,7 @@ h2 {
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.93);
background-color: black;
padding: 8px;
border-radius: 0 0 0 4px;

Expand Down

0 comments on commit 942ccc8

Please sign in to comment.