avoid emitting spurious changeWrapMode event

This commit is contained in:
nightwing 2015-01-19 01:15:24 +04:00
commit 7db217dfe0

View file

@ -1580,12 +1580,10 @@ var EditSession = function(text, mode) {
**/ **/
this.setWrapLimitRange = function(min, max) { this.setWrapLimitRange = function(min, max) {
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange = { this.$wrapLimitRange = { min: min, max: max };
min: min,
max: max
};
this.$modified = true; this.$modified = true;
// This will force a recalculation of the wrap limit // This will force a recalculation of the wrap limit
if (this.$useWrapMode)
this._signal("changeWrapMode"); this._signal("changeWrapMode");
} }
}; };
@ -2467,6 +2465,7 @@ config.defineOptions(EditSession.prototype, "session", {
if (this.$wrap == value) if (this.$wrap == value)
return; return;
this.$wrap = value;
if (!value) { if (!value) {
this.setUseWrapMode(false); this.setUseWrapMode(false);
} else { } else {
@ -2474,7 +2473,6 @@ config.defineOptions(EditSession.prototype, "session", {
this.setWrapLimitRange(col, col); this.setWrapLimitRange(col, col);
this.setUseWrapMode(true); this.setUseWrapMode(true);
} }
this.$wrap = value;
}, },
get: function() { get: function() {
if (this.getUseWrapMode()) { if (this.getUseWrapMode()) {