Compute on document#setValue and fire changeWrapMode if wrapLimit changes
This commit is contained in:
parent
a0a0541daa
commit
e584900ddc
2 changed files with 8 additions and 3 deletions
|
|
@ -86,6 +86,7 @@ var Document = function(text, mode) {
|
||||||
this.lines.splice.apply(this.lines, args);
|
this.lines.splice.apply(this.lines, args);
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
this.fireChangeEvent(0);
|
this.fireChangeEvent(0);
|
||||||
|
this.$updateWrapData(0, this.lines.length - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toString = function() {
|
this.toString = function() {
|
||||||
|
|
@ -302,8 +303,8 @@ var Document = function(text, mode) {
|
||||||
return this.screenWidth;
|
return this.screenWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$computeWidth = function() {
|
this.$computeWidth = function(force) {
|
||||||
if (this.modified) {
|
if (this.modified || force) {
|
||||||
this.modified = false;
|
this.modified = false;
|
||||||
|
|
||||||
var lines = this.lines;
|
var lines = this.lines;
|
||||||
|
|
@ -804,6 +805,7 @@ var Document = function(text, mode) {
|
||||||
this.$useWrapMode = useWrapMode;
|
this.$useWrapMode = useWrapMode;
|
||||||
this.$updateWrapData(0, this.lines.length - 1);
|
this.$updateWrapData(0, this.lines.length - 1);
|
||||||
this._dispatchEvent("changeWrapMode");
|
this._dispatchEvent("changeWrapMode");
|
||||||
|
this.$computeWidth(true);
|
||||||
this.fireChangeEvent(0);
|
this.fireChangeEvent(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -813,9 +815,12 @@ var Document = function(text, mode) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setWrapLimit = function(wrapLimit) {
|
this.setWrapLimit = function(wrapLimit) {
|
||||||
|
wrapLimit = Math.floor(wrapLimit);
|
||||||
if (wrapLimit != this.$wrapLimit) {
|
if (wrapLimit != this.$wrapLimit) {
|
||||||
this.$wrapLimit = wrapLimit;
|
this.$wrapLimit = wrapLimit;
|
||||||
this.$updateWrapData(0, this.lines.length - 1);
|
this.$updateWrapData(0, this.lines.length - 1);
|
||||||
|
this._dispatchEvent("changeWrapMode");
|
||||||
|
this.$computeWidth(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6024eafb2559208e8f439d6f25a609d8c020d214
|
Subproject commit 36c55c39e8ede94e964364e01ab5308f3f51c2eb
|
||||||
Loading…
Add table
Add a link
Reference in a new issue