From fafd05f014a95fd2c646a966b66c30d9811c546b Mon Sep 17 00:00:00 2001 From: "Alexander J. Vincent" Date: Thu, 30 Nov 2017 23:42:50 -0800 Subject: [PATCH] #137: CodeMirror tail text locks must deny appending to end of file. --- docs/gui/utilities/CodeMirrorManager.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/gui/utilities/CodeMirrorManager.js b/docs/gui/utilities/CodeMirrorManager.js index f101d804..1e28d487 100644 --- a/docs/gui/utilities/CodeMirrorManager.js +++ b/docs/gui/utilities/CodeMirrorManager.js @@ -35,7 +35,12 @@ const CodeMirrorManager = window.CodeMirrorManager = { getTextLock: function(editor, startLine, endLine) { const doc = editor.getDoc(); - const options = Object.freeze({ readOnly: true, className: "readOnly" }); + const options = { readOnly: true, className: "readOnly" }; + if (startLine === 0) + options.inclusiveLeft = true; + if (endLine === Infinity) + options.inclusiveRight = true; + Object.freeze(options); let mark = doc.markText( {line: startLine, ch: 0}, {line: endLine, ch: 0},