Skip to content

Commit

Permalink
remove jitter from gutter resize
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Mar 31, 2018
1 parent fcccf49 commit 7627883
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 2 additions & 0 deletions lib/ace/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
overflow : hidden;
width: auto;
top: 0;
bottom: 0;
left: 0;
cursor: default;
z-index: 4;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
contain: style size layout;
}

.ace_gutter-active-line {
Expand Down
3 changes: 2 additions & 1 deletion lib/ace/layer/gutter.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ var Gutter = function(parentEl) {
gutterWidth += padding.left + padding.right;
if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
this.gutterWidth = gutterWidth;
this.element.parentNode.style.width =
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
this._signal("changeGutterWidth", gutterWidth);
}
Expand All @@ -205,7 +206,7 @@ var Gutter = function(parentEl) {
if (!this.$highlightGutterLine)
return;
var row = this.session.selection.cursor.row;
this.$cursorRow = row
this.$cursorRow = row;

if (this.$cursorCell && this.$cursorCell.row == row)
return;
Expand Down
29 changes: 13 additions & 16 deletions lib/ace/virtual_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,22 +429,19 @@ var VirtualRenderer = function(container, theme) {
return changes;
};

this.onGutterResize = function() {
var that = this;
setTimeout(function() {
var gutterWidth = that.$showGutter ? that.$gutter.offsetWidth : 0;
if (gutterWidth != that.gutterWidth)
that.$changes |= that.$updateCachedSize(true, gutterWidth, that.$size.width, that.$size.height);

if (that.session.getUseWrapMode() && that.adjustWrapLimit()) {
that.$loop.schedule(that.CHANGE_FULL);
} else if (that.$size.$dirty) {
that.$loop.schedule(that.CHANGE_FULL);
} else {
that.$computeLayerConfig();
that.$loop.schedule(that.CHANGE_MARKER);
}
}, 0);
this.onGutterResize = function(width) {
var gutterWidth = this.$showGutter ? width : 0;
if (gutterWidth != this.gutterWidth)
this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);

if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
this.$loop.schedule(this.CHANGE_FULL);
} else if (this.$size.$dirty) {
this.$loop.schedule(this.CHANGE_FULL);
} else {
this.$computeLayerConfig();
this.$loop.schedule(this.CHANGE_MARKER);
}
};

/**
Expand Down

0 comments on commit 7627883

Please sign in to comment.