diff --git a/src/view/code.tsx b/src/view/code.tsx index e7a54d54..d8e2b511 100644 --- a/src/view/code.tsx +++ b/src/view/code.tsx @@ -202,16 +202,26 @@ class SourceCodeRenderer extends React.Component< setEditorHeight = () => { const fullWindowHeight = this.props.opts.maxSize.height; let _editorHeight = fullWindowHeight; - if (this.props.readOnly || this.state.isClosed) { + let allowEditing = this.getAllowEditing(); + if (!allowEditing) { const noOfLines = Math.max(this.state.code.split("\n").length, 5); _editorHeight = Math.min(noOfLines * GlobalModel.termFontSize.get() * 1.5 + 10, fullWindowHeight); } this.setState({ editorHeight: _editorHeight }, () => this.props.scrollToBringIntoViewport()); }; + getAllowEditing(): boolean { + let lineState = this.props.lineState; + let mode = lineState["mode"] || "view"; + if (mode == "view") { + return false; + } + return !(this.props.readOnly || this.state.isClosed); + } + render() { - const { opts, exitcode, readOnly } = this.props; - const { selectedLanguage, code, isSave, isClosed } = this.state; + const { opts, exitcode } = this.props; + const { selectedLanguage, code, isSave } = this.state; if (code == null) return
; @@ -230,6 +240,7 @@ class SourceCodeRenderer extends React.Component< ); + let allowEditing = this.getAllowEditing(); return (