@@ -213,7 +213,7 @@ window.CodeMirror = (function() {
213213 estimateLineHeights ( cm ) ;
214214 regChange ( cm ) ;
215215 clearCaches ( cm ) ;
216- setTimeout ( function ( ) { updateScrollbars ( cm . display , cm . doc . height , cm . options . fixedGutter ) ; } , 100 ) ;
216+ setTimeout ( function ( ) { updateScrollbars ( cm ) ; } , 100 ) ;
217217 }
218218
219219 function estimateHeight ( cm ) {
@@ -251,6 +251,7 @@ window.CodeMirror = (function() {
251251
252252 function guttersChanged ( cm ) {
253253 updateGutters ( cm ) ;
254+ alignHorizontally ( cm ) ;
254255 regChange ( cm ) ;
255256 }
256257
@@ -318,7 +319,8 @@ window.CodeMirror = (function() {
318319
319320 // Re-synchronize the fake scrollbars with the actual size of the
320321 // content. Optionally force a scrollTop.
321- function updateScrollbars ( d /* display */ , docHeight , fixedGutter ) {
322+ function updateScrollbars ( cm ) {
323+ var d = cm . display , docHeight = cm . doc . height ;
322324 var totalHeight = docHeight + paddingVert ( d ) ;
323325 d . sizer . style . minHeight = d . heightForcer . style . top = totalHeight + "px" ;
324326 var scrollHeight = Math . max ( totalHeight , d . scroller . scrollHeight ) ;
@@ -340,7 +342,7 @@ window.CodeMirror = (function() {
340342 d . scrollbarFiller . style . display = "block" ;
341343 d . scrollbarFiller . style . height = d . scrollbarFiller . style . width = scrollbarWidth ( d . measure ) + "px" ;
342344 } else d . scrollbarFiller . style . display = "" ;
343- if ( needsH && fixedGutter ) {
345+ if ( needsH && cm . options . coverGutterNextToScrollbar && cm . options . fixedGutter ) {
344346 d . gutterFiller . style . display = "block" ;
345347 d . gutterFiller . style . height = scrollbarWidth ( d . measure ) + "px" ;
346348 d . gutterFiller . style . width = d . gutters . offsetWidth + "px" ;
@@ -410,7 +412,7 @@ window.CodeMirror = (function() {
410412 signalLater ( cm , "viewportChange" , cm , cm . display . showingFrom , cm . display . showingTo ) ;
411413 } else break ;
412414 updateSelection ( cm ) ;
413- updateScrollbars ( cm . display , cm . doc . height , cm . options . fixedGutter ) ;
415+ updateScrollbars ( cm ) ;
414416
415417 // Clip forced viewport to actual scrollable area
416418 if ( viewPort )
@@ -3123,6 +3125,7 @@ window.CodeMirror = (function() {
31233125 cm . display . gutters . style . left = val ? compensateForHScroll ( cm . display ) + "px" : "0" ;
31243126 cm . refresh ( ) ;
31253127 } , true ) ;
3128+ option ( "coverGutterNextToScrollbar" , false , updateScrollbars ) ;
31263129 option ( "lineNumbers" , false , function ( cm ) {
31273130 setGuttersForLineNumbers ( cm . options ) ;
31283131 guttersChanged ( cm ) ;
0 commit comments