From e584900ddc9b9c90fb356df1bd14ee78dbea89d1 Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Wed, 26 Jan 2011 13:17:24 +0100 Subject: [PATCH] Compute on document#setValue and fire changeWrapMode if wrapLimit changes --- lib/ace/document.js | 9 +++++++-- support/cockpit | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ace/document.js b/lib/ace/document.js index b4b1d674..ba2c3807 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -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); } }; diff --git a/support/cockpit b/support/cockpit index 6024eafb..36c55c39 160000 --- a/support/cockpit +++ b/support/cockpit @@ -1 +1 @@ -Subproject commit 6024eafb2559208e8f439d6f25a609d8c020d214 +Subproject commit 36c55c39e8ede94e964364e01ab5308f3f51c2eb