From 3e0351ca98f61371de37b439b6f40481643a42c9 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 26 Aug 2012 22:40:43 +0400 Subject: [PATCH] fix gutter width calculation --- lib/ace/layer/gutter.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js index 2a9438b4..fde13a0e 100644 --- a/lib/ace/layer/gutter.js +++ b/lib/ace/layer/gutter.js @@ -93,11 +93,11 @@ var Gutter = function(parentEl) { rowInfo.text.push(annoText); var type = annotation.type; if (type == "error") - rowInfo.className = "ace_error"; - else if (type == "warning" && rowInfo.className != "ace_error") - rowInfo.className = "ace_warning"; + rowInfo.className = " ace_error"; + else if (type == "warning" && rowInfo.className != " ace_error") + rowInfo.className = " ace_warning"; else if (type == "info" && (!rowInfo.className)) - rowInfo.className = "ace_info"; + rowInfo.className = " ace_info"; } } }; @@ -112,6 +112,7 @@ var Gutter = function(parentEl) { var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets; var breakpoints = this.session.$breakpoints; var decorations = this.session.$decorations; + var lastLineNumber = 0; while (true) { if(i > foldStart) { @@ -127,7 +128,7 @@ var Gutter = function(parentEl) { "
", - i + 1 + lastLineNumber = i + 1 ); if (foldWidgets) { @@ -152,13 +153,14 @@ var Gutter = function(parentEl) { this.element.style.height = config.minHeight + "px"; if (this.session.$useWrapMode) - i = this.session.getLength(); + lastLineNumber = this.session.getLength(); - var gutterWidth = ("" + --i).length * config.characterWidth; + var gutterWidth = ("" + lastLineNumber).length * config.characterWidth; var padding = this.$padding || this.$computePadding(); gutterWidth += padding.left + padding.right; if (gutterWidth !== this.gutterWidth) { this.gutterWidth = gutterWidth; + this.element.style.width = Math.ceil(this.gutterWidth) + "px"; this._emit("changeGutterWidth", gutterWidth); } };