@@ -795,7 +795,7 @@ function checkEditorStyle() {
795795 if ( scrollbarStyle == 'overlay' || currentMode == modeType . both ) {
796796 ui . area . codemirrorScroll . css ( 'height' , desireHeight + 'px' ) ;
797797 ui . area . codemirrorScroll . css ( 'min-height' , '' ) ;
798- editor . refresh ( ) ;
798+ checkEditorScrollbar ( ) ;
799799 } else if ( scrollbarStyle == 'native' ) {
800800 ui . area . codemirrorScroll . css ( 'height' , '' ) ;
801801 ui . area . codemirrorScroll . css ( 'min-height' , desireHeight + 'px' ) ;
@@ -835,7 +835,7 @@ function checkEditorStyle() {
835835 ui . area . view . scroll ( ) ;
836836 } ) ;
837837 }
838- editor . refresh ( ) ;
838+ checkEditorScrollbar ( ) ;
839839 }
840840 } ) ;
841841 ui . area . resize . handle = $ ( '.ui-resizable-handle' ) ;
@@ -876,6 +876,14 @@ function checkSyncToggle() {
876876 }
877877}
878878
879+ function checkEditorScrollbar ( ) {
880+ // workaround simple scroll bar knob
881+ // will get wrong position when editor height changed
882+ var scrollInfo = editor . getScrollInfo ( ) ;
883+ editor . scrollTo ( null , scrollInfo . top - 1 ) ;
884+ editor . scrollTo ( null , scrollInfo . top ) ;
885+ }
886+
879887function checkTocStyle ( ) {
880888 //toc right
881889 var paddingRight = parseFloat ( ui . area . markdown . css ( 'padding-right' ) ) ;
@@ -2509,6 +2517,7 @@ editor.on('changes', function (cm, changes) {
25092517 viewportMargin = newViewportMargin ;
25102518 windowResize ( ) ;
25112519 }
2520+ checkEditorScrollbar ( ) ;
25122521} ) ;
25132522editor . on ( 'focus' , function ( cm ) {
25142523 for ( var i = 0 ; i < onlineUsers . length ; i ++ ) {
0 commit comments