(text, mode, firstLine, lineSep, direction)
| 6019 | |
| 6020 | var nextDocId = 0; |
| 6021 | var Doc = function(text, mode, firstLine, lineSep, direction) { |
| 6022 | if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) } |
| 6023 | if (firstLine == null) { firstLine = 0; } |
| 6024 | |
| 6025 | BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); |
| 6026 | this.first = firstLine; |
| 6027 | this.scrollTop = this.scrollLeft = 0; |
| 6028 | this.cantEdit = false; |
| 6029 | this.cleanGeneration = 1; |
| 6030 | this.modeFrontier = this.highlightFrontier = firstLine; |
| 6031 | var start = Pos(firstLine, 0); |
| 6032 | this.sel = simpleSelection(start); |
| 6033 | this.history = new History(null); |
| 6034 | this.id = ++nextDocId; |
| 6035 | this.modeOption = mode; |
| 6036 | this.lineSep = lineSep; |
| 6037 | this.direction = (direction == "rtl") ? "rtl" : "ltr"; |
| 6038 | this.extend = false; |
| 6039 | |
| 6040 | if (typeof text == "string") { text = this.splitLines(text); } |
| 6041 | updateDoc(this, {from: start, to: start, text: text}); |
| 6042 | setSelection(this, simpleSelection(start), sel_dontScroll); |
| 6043 | }; |
| 6044 | |
| 6045 | Doc.prototype = createObj(BranchChunk.prototype, { |
| 6046 | constructor: Doc, |
nothing calls this directly
no test coverage detected