diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css
index f0d31f10..04cfff28 100644
--- a/lib/ace/css/editor.css
+++ b/lib/ace/css/editor.css
@@ -131,7 +131,6 @@
.ace_gutter .ace_layer {
position: relative;
- min-width: 40px;
width: auto;
text-align: right;
pointer-events: auto;
diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js
index 2bf3bc53..4b67989c 100644
--- a/lib/ace/layer/gutter.js
+++ b/lib/ace/layer/gutter.js
@@ -149,17 +149,15 @@ var Gutter = function(parentEl) {
i++;
}
- if (this.session.$useWrapMode)
- html.push(
- "
",
- this.session.getLength() - 1,
- "
"
- );
-
this.element = dom.setInnerHtml(this.element, html.join(""));
this.element.style.height = config.minHeight + "px";
- var gutterWidth = this.element.offsetWidth;
+ if (this.session.$useWrapMode)
+ i = this.session.getLength();
+
+ var gutterWidth = ("" + --i).length * config.characterWidth;
+ var padding = this.$padding || this.$computePadding();
+ gutterWidth += padding.left + padding.right;
if (gutterWidth !== this.gutterWidth) {
this.gutterWidth = gutterWidth;
this._emit("changeGutterWidth", gutterWidth);