(text, mode, firstLine, lineSep, direction)
| 6068 | |
| 6069 | var nextDocId = 0; |
| 6070 | var Doc = function(text, mode, firstLine, lineSep, direction) { |
| 6071 | if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) } |
| 6072 | if (firstLine == null) { firstLine = 0; } |
| 6073 | |
| 6074 | BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); |
| 6075 | this.first = firstLine; |
| 6076 | this.scrollTop = this.scrollLeft = 0; |
| 6077 | this.cantEdit = false; |
| 6078 | this.cleanGeneration = 1; |
| 6079 | this.modeFrontier = this.highlightFrontier = firstLine; |
| 6080 | var start = Pos(firstLine, 0); |
| 6081 | this.sel = simpleSelection(start); |
| 6082 | this.history = new History(null); |
| 6083 | this.id = ++nextDocId; |
| 6084 | this.modeOption = mode; |
| 6085 | this.lineSep = lineSep; |
| 6086 | this.direction = (direction == "rtl") ? "rtl" : "ltr"; |
| 6087 | this.extend = false; |
| 6088 | |
| 6089 | if (typeof text == "string") { text = this.splitLines(text); } |
| 6090 | updateDoc(this, {from: start, to: start, text: text}); |
| 6091 | setSelection(this, simpleSelection(start), sel_dontScroll); |
| 6092 | }; |
| 6093 | |
| 6094 | Doc.prototype = createObj(BranchChunk.prototype, { |
| 6095 | constructor: Doc, |
nothing calls this directly
no test coverage detected