File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -721,15 +721,17 @@ function windowResizeInner(callback) {
721721 //refresh editor
722722 if ( loaded ) {
723723 if ( editor . getOption ( 'scrollbarStyle' ) === 'native' ) {
724- clearMap ( ) ;
725- if ( editorHasFocus ( ) ) {
726- syncScrollToView ( ) ;
727- } else {
728- syncScrollToEdit ( ) ;
729- }
730- updateScrollspy ( ) ;
731- if ( callback && typeof callback === 'function' )
732- callback ( ) ;
724+ setTimeout ( function ( ) {
725+ clearMap ( ) ;
726+ if ( editorHasFocus ( ) ) {
727+ syncScrollToView ( ) ;
728+ } else {
729+ syncScrollToEdit ( ) ;
730+ }
731+ updateScrollspy ( ) ;
732+ if ( callback && typeof callback === 'function' )
733+ callback ( ) ;
734+ } , 1 ) ;
733735 } else {
734736 // force it load all docs at once to prevent scroll knob blink
735737 editor . setOption ( 'viewportMargin' , Infinity ) ;
@@ -1030,6 +1032,11 @@ function changeMode(type) {
10301032 preventSyncScrollToEdit = 2 ;
10311033 syncScrollToView ( ) ;
10321034 }
1035+
1036+ if ( lastMode == modeType . both && currentMode != modeType . both ) {
1037+ preventSyncScrollToView = false ;
1038+ preventSyncScrollToEdit = false ;
1039+ }
10331040
10341041 if ( lastMode != modeType . edit && currentMode == modeType . edit ) {
10351042 editor . refresh ( ) ;
Original file line number Diff line number Diff line change @@ -120,11 +120,7 @@ var viewScrollingDebounce = 200;
120120var editScrolling = false ;
121121var editScrollingDebounce = 200 ;
122122
123- if ( editor . getOption ( 'scrollbarStyle' ) === 'native' ) {
124- ui . area . codemirrorScroll . on ( 'scroll' , _ . throttle ( syncScrollToView , editScrollThrottle ) ) ;
125- } else {
126- editor . on ( 'scroll' , _ . throttle ( syncScrollToView , editScrollThrottle ) ) ;
127- }
123+ ui . area . codemirrorScroll . on ( 'scroll' , _ . throttle ( syncScrollToView , editScrollThrottle ) ) ;
128124ui . area . view . on ( 'scroll' , _ . throttle ( syncScrollToEdit , viewScrollThrottle ) ) ;
129125
130126var scrollMap , lineHeightMap , viewTop , viewBottom ;
You can’t perform that action at this time.
0 commit comments