Merge pull request #2080 from jpallen/master
Keep apparent scroll position fixed when changes are made offscreen
This commit is contained in:
commit
3c4afde47b
1 changed files with 9 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue