Skip to content

Commit

Permalink
Check if console widget is active before refitting terminal canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
walidkayhan committed Dec 19, 2023
1 parent d759835 commit 4202aa5
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/app/widgets/Console/Terminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class TerminalWrapper extends PureComponent {
this.term.loadAddon(this.fitAddon);
this.term.prompt = () => {
this.term.write('\r\n');
//this.term.write(color.white(this.prompt));
};

const el = ReactDOM.findDOMNode(this.terminalContainer);
Expand Down Expand Up @@ -143,11 +142,9 @@ class TerminalWrapper extends PureComponent {
}

componentDidUpdate(_, prevState) {
if (this.props.active) {
setTimeout(() => {
this.refitTerminal();
}, 150);
}
setTimeout(() => {
this.refitTerminal();
}, 150);

if (this.state.terminalInputIndex !== prevState.terminalInputIndex) {
const { terminalInputHistory } = this.state;
Expand All @@ -156,8 +153,6 @@ class TerminalWrapper extends PureComponent {
return;
}

// const inputSize = [...terminalInputHistory[this.state.terminalInputIndex] || ''].length;

this.inputRef.current.focus();
this.inputRef.current.value = terminalInputHistory[this.state.terminalInputIndex] || '';
}
Expand Down Expand Up @@ -203,7 +198,7 @@ class TerminalWrapper extends PureComponent {
}

refitTerminal() {
if (this.fitAddon) {
if (this.fitAddon && this.props.active) {
this.fitAddon.fit();
}
}
Expand Down Expand Up @@ -283,9 +278,6 @@ class TerminalWrapper extends PureComponent {
const rs = reduxStore.getState();
const selection = get(rs, 'controller.terminalHistory');
const text = selection.slice(-LINES_TO_COPY).join('\n');
//this.term.selectAll();
//const selection = this.term.getSelection().split('\n');
//this.term.clearSelection();

if (isElectron()) {
window.ipcRenderer.send('clipboard', text);
Expand Down

0 comments on commit 4202aa5

Please sign in to comment.