update fold widgets in mixed modes when tokenizer state changes
This commit is contained in:
parent
742e8c01a8
commit
3a8b279e43
1 changed files with 11 additions and 3 deletions
|
|
@ -696,7 +696,8 @@ function Folding() {
|
||||||
|
|
||||||
this.$foldMode = foldMode;
|
this.$foldMode = foldMode;
|
||||||
|
|
||||||
this.removeListener('change', this.$updateFoldWidgets);
|
this.off('change', this.$updateFoldWidgets);
|
||||||
|
this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
|
||||||
this._emit("changeAnnotation");
|
this._emit("changeAnnotation");
|
||||||
|
|
||||||
if (!foldMode || this.$foldStyle == "manual") {
|
if (!foldMode || this.$foldStyle == "manual") {
|
||||||
|
|
@ -709,8 +710,9 @@ function Folding() {
|
||||||
this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
|
this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
|
||||||
|
|
||||||
this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
|
this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
|
||||||
|
this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
|
||||||
this.on('change', this.$updateFoldWidgets);
|
this.on('change', this.$updateFoldWidgets);
|
||||||
|
this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getParentFoldRangeData = function (row, ignoreCurrent) {
|
this.getParentFoldRangeData = function (row, ignoreCurrent) {
|
||||||
|
|
@ -843,7 +845,13 @@ function Folding() {
|
||||||
this.foldWidgets.splice.apply(this.foldWidgets, args);
|
this.foldWidgets.splice.apply(this.foldWidgets, args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
this.tokenizerUpdateFoldWidgets = function(e) {
|
||||||
|
var rows = e.data;
|
||||||
|
if (rows.first != rows.last) {
|
||||||
|
if (this.foldWidgets.length > rows.first)
|
||||||
|
this.foldWidgets.splice(rows.first, this.foldWidgets.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Folding = Folding;
|
exports.Folding = Folding;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue