Merge pull request #2080 from jpallen/master

Keep apparent scroll position fixed when changes are made offscreen
This commit is contained in:
Harutyun Amirjanyan 2014-08-20 15:49:03 +04:00
commit 3c4afde47b

View file

@ -812,6 +812,15 @@ var VirtualRenderer = function(container, theme) {
changes & this.CHANGE_H_SCROLL
) {
changes |= this.$computeLayerConfig();
// If a change is made offscreen and wrapMode is on, then the onscreen
// lines may have been pushed down. If so, the first screen row will not
// have changed, but the first actual row will. In that case, adjust
// scrollTop so that the cursor and onscreen content stays in the same place.
if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
this.scrollTop = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
changes = changes | this.CHANGE_SCROLL;
changes |= this.$computeLayerConfig();
}
config = this.layerConfig;
// update scrollbar first to not lose scroll position when gutter calls resize
this.$updateScrollBarV();