Skip to content

Commit a5df839

Browse files
committed
Properly detect changes that should reset cantEdit flag
Issue #5974
1 parent dc93109 commit a5df839

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/model/Doc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ Doc.prototype = createObj(BranchChunk.prototype, {
7575
let top = Pos(this.first, 0), last = this.first + this.size - 1
7676
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
7777
text: this.splitLines(code), origin: "setValue", full: true}, true)
78-
this.cantEdit = false
7978
if (this.cm) scrollToCoords(this.cm, 0, 0)
8079
setSelection(this, simpleSelection(top), sel_dontScroll)
8180
}),

src/model/changes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ function makeChangeSingleDoc(doc, change, selAfter, spans) {
202202
if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans)
203203
else updateDoc(doc, change, spans)
204204
setSelectionNoUndo(doc, selAfter, sel_dontScroll)
205+
206+
if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
207+
doc.cantEdit = false
205208
}
206209

207210
// Handle the interaction of a change to a document with the editor

0 commit comments

Comments
 (0)