(text, mode, firstLine, lineSep, direction)
| 8192 | |
| 8193 | var nextDocId = 0 |
| 8194 | var Doc = function (text, mode, firstLine, lineSep, direction) { |
| 8195 | if (!(this instanceof Doc)) { |
| 8196 | return new Doc(text, mode, firstLine, lineSep, direction) |
| 8197 | } |
| 8198 | if (firstLine == null) { |
| 8199 | firstLine = 0 |
| 8200 | } |
| 8201 | |
| 8202 | BranchChunk.call(this, [new LeafChunk([new Line("", null)])]) |
| 8203 | this.first = firstLine |
| 8204 | this.scrollTop = this.scrollLeft = 0 |
| 8205 | this.cantEdit = false |
| 8206 | this.cleanGeneration = 1 |
| 8207 | this.modeFrontier = this.highlightFrontier = firstLine |
| 8208 | var start = Pos(firstLine, 0) |
| 8209 | this.sel = simpleSelection(start) |
| 8210 | this.history = new History(null) |
| 8211 | this.id = ++nextDocId |
| 8212 | this.modeOption = mode |
| 8213 | this.lineSep = lineSep |
| 8214 | this.direction = direction == "rtl" ? "rtl" : "ltr" |
| 8215 | this.extend = false |
| 8216 | |
| 8217 | if (typeof text == "string") { |
| 8218 | text = this.splitLines(text) |
| 8219 | } |
| 8220 | updateDoc(this, { from: start, to: start, text: text }) |
| 8221 | setSelection(this, simpleSelection(start), sel_dontScroll) |
| 8222 | } |
| 8223 | |
| 8224 | Doc.prototype = createObj(BranchChunk.prototype, { |
| 8225 | constructor: Doc, |
nothing calls this directly
no test coverage detected