File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -816,10 +816,15 @@ var VirtualRenderer = function(container, theme) {
816
816
// lines may have been pushed down. If so, the first screen row will not
817
817
// have changed, but the first actual row will. In that case, adjust
818
818
// scrollTop so that the cursor and onscreen content stays in the same place.
819
+ // TODO: find a better way to handle this, that works non wrapped case and doesn't compute layerConfig twice
819
820
if ( config . firstRow != this . layerConfig . firstRow && config . firstRowScreen == this . layerConfig . firstRowScreen ) {
820
- this . scrollTop = this . scrollTop + ( config . firstRow - this . layerConfig . firstRow ) * this . lineHeight ;
821
- changes = changes | this . CHANGE_SCROLL ;
822
- changes |= this . $computeLayerConfig ( ) ;
821
+ var st = this . scrollTop + ( config . firstRow - this . layerConfig . firstRow ) * this . lineHeight ;
822
+ if ( st > 0 ) {
823
+ // this check is needed as a workaround for the documentToScreenRow returning -1 if document.length == 0
824
+ this . scrollTop = st ;
825
+ changes = changes | this . CHANGE_SCROLL ;
826
+ changes |= this . $computeLayerConfig ( ) ;
827
+ }
823
828
}
824
829
config = this . layerConfig ;
825
830
// update scrollbar first to not lose scroll position when gutter calls resize
You can’t perform that action at this time.
0 commit comments