diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index fbc2ecaa..e0326bca 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -427,18 +427,20 @@ var VirtualRenderer = function(container, theme) { // full if (changes & this.CHANGE_FULL) { + // update scrollbar first to not loose scroll position when gutter calls resize + this.$updateScrollBar(); this.$textLayer.update(this.layerConfig); if (this.showGutter) this.$gutterLayer.update(this.layerConfig); this.$markerBack.update(this.layerConfig); this.$markerFront.update(this.layerConfig); this.$cursorLayer.update(this.layerConfig); - this.$updateScrollBar(); return; } // scrolling if (changes & this.CHANGE_SCROLL) { + this.$updateScrollBar(); if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES) this.$textLayer.update(this.layerConfig); else @@ -449,7 +451,6 @@ var VirtualRenderer = function(container, theme) { this.$markerBack.update(this.layerConfig); this.$markerFront.update(this.layerConfig); this.$cursorLayer.update(this.layerConfig); - this.$updateScrollBar(); return; }