(text, mode, firstLine, lineSep, direction)
| 21 | |
| 22 | let nextDocId = 0 |
| 23 | let Doc = function(text, mode, firstLine, lineSep, direction) { |
| 24 | if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep, direction) |
| 25 | if (firstLine == null) firstLine = 0 |
| 26 | |
| 27 | BranchChunk.call(this, [new LeafChunk([new Line("", null)])]) |
| 28 | this.first = firstLine |
| 29 | this.scrollTop = this.scrollLeft = 0 |
| 30 | this.cantEdit = false |
| 31 | this.cleanGeneration = 1 |
| 32 | this.modeFrontier = this.highlightFrontier = firstLine |
| 33 | let start = Pos(firstLine, 0) |
| 34 | this.sel = simpleSelection(start) |
| 35 | this.history = new History(null) |
| 36 | this.id = ++nextDocId |
| 37 | this.modeOption = mode |
| 38 | this.lineSep = lineSep |
| 39 | this.direction = (direction == "rtl") ? "rtl" : "ltr" |
| 40 | this.extend = false |
| 41 | |
| 42 | if (typeof text == "string") text = this.splitLines(text) |
| 43 | updateDoc(this, {from: start, to: start, text: text}) |
| 44 | setSelection(this, simpleSelection(start), sel_dontScroll) |
| 45 | } |
| 46 | |
| 47 | Doc.prototype = createObj(BranchChunk.prototype, { |
| 48 | constructor: Doc, |
nothing calls this directly
no test coverage detected