|
4798 | 4798 | }); |
4799 | 4799 | } |
4800 | 4800 |
|
4801 | | - function History(startGen) { |
| 4801 | + function History(prev) { |
4802 | 4802 | // Arrays of change events and selections. Doing something adds an |
4803 | 4803 | // event to done and clears undo. Undoing moves events from done |
4804 | 4804 | // to undone, redoing moves them in the other direction. |
4805 | 4805 | this.done = []; this.undone = []; |
4806 | | - this.undoDepth = Infinity; |
| 4806 | + this.undoDepth = prev ? prev.undoDepth : Infinity; |
4807 | 4807 | // Used to track when changes can be merged into a single undo |
4808 | 4808 | // event |
4809 | 4809 | this.lastModTime = this.lastSelTime = 0; |
4810 | 4810 | this.lastOp = this.lastSelOp = null; |
4811 | 4811 | this.lastOrigin = this.lastSelOrigin = null; |
4812 | 4812 | // Used by the isClean() method |
4813 | | - this.generation = this.maxGeneration = startGen || 1; |
| 4813 | + this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1; |
4814 | 4814 | } |
4815 | 4815 |
|
4816 | 4816 | // Create a history change event from an updateDoc-style change |
|
6181 | 6181 | var out = []; |
6182 | 6182 | for (var i = 0; i < ranges.length; i++) |
6183 | 6183 | { out[i] = new Range(clipPos(this, ranges[i].anchor), |
6184 | | - clipPos(this, ranges[i].head)); } |
| 6184 | + clipPos(this, ranges[i].head || ranges[i].anchor)); } |
6185 | 6185 | if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } |
6186 | 6186 | setSelection(this, normalizeSelection(this.cm, out, primary), options); |
6187 | 6187 | }), |
|
6244 | 6244 | clearHistory: function() { |
6245 | 6245 | var this$1 = this; |
6246 | 6246 |
|
6247 | | - this.history = new History(this.history.maxGeneration); |
| 6247 | + this.history = new History(this.history); |
6248 | 6248 | linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true); |
6249 | 6249 | }, |
6250 | 6250 |
|
|
6265 | 6265 | undone: copyHistoryArray(this.history.undone)} |
6266 | 6266 | }, |
6267 | 6267 | setHistory: function(histData) { |
6268 | | - var hist = this.history = new History(this.history.maxGeneration); |
| 6268 | + var hist = this.history = new History(this.history); |
6269 | 6269 | hist.done = copyHistoryArray(histData.done.slice(0), null, true); |
6270 | 6270 | hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); |
6271 | 6271 | }, |
|
7708 | 7708 | for (var i = newBreaks.length - 1; i >= 0; i--) |
7709 | 7709 | { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } |
7710 | 7710 | }); |
7711 | | - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { |
| 7711 | + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { |
7712 | 7712 | cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); |
7713 | 7713 | if (old != Init) { cm.refresh(); } |
7714 | 7714 | }); |
|
8766 | 8766 |
|
8767 | 8767 | var input = this, cm = input.cm; |
8768 | 8768 | var div = input.div = display.lineDiv; |
| 8769 | + div.contentEditable = true; |
8769 | 8770 | disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize); |
8770 | 8771 |
|
8771 | 8772 | function belongsToInput(e) { |
|
9793 | 9794 |
|
9794 | 9795 | addLegacyProps(CodeMirror); |
9795 | 9796 |
|
9796 | | - CodeMirror.version = "5.59.2"; |
| 9797 | + CodeMirror.version = "5.60.0"; |
9797 | 9798 |
|
9798 | 9799 | return CodeMirror; |
9799 | 9800 |
|
|
0 commit comments