Skip to content

Commit

Permalink
Properly detect changes that should reset cantEdit flag
Browse files Browse the repository at this point in the history
Issue #5974
  • Loading branch information
marijnh committed Aug 19, 2019
1 parent dc93109 commit a5df839
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/model/Doc.js
Expand Up @@ -75,7 +75,6 @@ Doc.prototype = createObj(BranchChunk.prototype, {
let top = Pos(this.first, 0), last = this.first + this.size - 1
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
text: this.splitLines(code), origin: "setValue", full: true}, true)
this.cantEdit = false
if (this.cm) scrollToCoords(this.cm, 0, 0)
setSelection(this, simpleSelection(top), sel_dontScroll)
}),
Expand Down
3 changes: 3 additions & 0 deletions src/model/changes.js
Expand Up @@ -202,6 +202,9 @@ function makeChangeSingleDoc(doc, change, selAfter, spans) {
if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans)
else updateDoc(doc, change, spans)
setSelectionNoUndo(doc, selAfter, sel_dontScroll)

if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
doc.cantEdit = false
}

// Handle the interaction of a change to a document with the editor
Expand Down

0 comments on commit a5df839

Please sign in to comment.