Compute on document#setValue and fire changeWrapMode if wrapLimit changes

This commit is contained in:
Julian Viereck 2011-01-26 13:17:24 +01:00
commit e584900ddc
2 changed files with 8 additions and 3 deletions

View file

@ -86,6 +86,7 @@ var Document = function(text, mode) {
this.lines.splice.apply(this.lines, args);
this.modified = true;
this.fireChangeEvent(0);
this.$updateWrapData(0, this.lines.length - 1);
};
this.toString = function() {
@ -302,8 +303,8 @@ var Document = function(text, mode) {
return this.screenWidth;
};
this.$computeWidth = function() {
if (this.modified) {
this.$computeWidth = function(force) {
if (this.modified || force) {
this.modified = false;
var lines = this.lines;
@ -804,6 +805,7 @@ var Document = function(text, mode) {
this.$useWrapMode = useWrapMode;
this.$updateWrapData(0, this.lines.length - 1);
this._dispatchEvent("changeWrapMode");
this.$computeWidth(true);
this.fireChangeEvent(0);
}
};
@ -813,9 +815,12 @@ var Document = function(text, mode) {
};
this.setWrapLimit = function(wrapLimit) {
wrapLimit = Math.floor(wrapLimit);
if (wrapLimit != this.$wrapLimit) {
this.$wrapLimit = wrapLimit;
this.$updateWrapData(0, this.lines.length - 1);
this._dispatchEvent("changeWrapMode");
this.$computeWidth(true);
}
};

@ -1 +1 @@
Subproject commit 6024eafb2559208e8f439d6f25a609d8c020d214
Subproject commit 36c55c39e8ede94e964364e01ab5308f3f51c2eb