@@ -105,6 +105,7 @@ window.CodeMirror = (function() {
105105 d . scrollbarH = elt ( "div" , [ elt ( "div" , null , null , "height: 1px" ) ] , "CodeMirror-hscrollbar" ) ;
106106 d . scrollbarV = elt ( "div" , [ elt ( "div" , null , null , "width: 1px" ) ] , "CodeMirror-vscrollbar" ) ;
107107 d . scrollbarFiller = elt ( "div" , null , "CodeMirror-scrollbar-filler" ) ;
108+ d . gutterFiller = elt ( "div" , null , "CodeMirror-gutter-filler" ) ;
108109 // DIVs containing the selection and the actual code
109110 d . lineDiv = elt ( "div" , null , "CodeMirror-code" ) ;
110111 d . selectionDiv = elt ( "div" , null , null , "position: relative; z-index: 1" ) ;
@@ -133,7 +134,7 @@ window.CodeMirror = (function() {
133134 d . scroller . setAttribute ( "tabIndex" , "-1" ) ;
134135 // The element in which the editor lives.
135136 d . wrapper = elt ( "div" , [ d . inputDiv , d . scrollbarH , d . scrollbarV ,
136- d . scrollbarFiller , d . scroller ] , "CodeMirror" ) ;
137+ d . scrollbarFiller , d . gutterFiller , d . scroller ] , "CodeMirror" ) ;
137138 // Work around IE7 z-index bug
138139 if ( ie_lt8 ) { d . gutters . style . zIndex = - 1 ; d . scroller . style . paddingRight = 0 ; }
139140 if ( place . appendChild ) place . appendChild ( d . wrapper ) ; else place ( d . wrapper ) ;
@@ -212,7 +213,7 @@ window.CodeMirror = (function() {
212213 estimateLineHeights ( cm ) ;
213214 regChange ( cm ) ;
214215 clearCaches ( cm ) ;
215- setTimeout ( function ( ) { updateScrollbars ( cm . display , cm . doc . height ) ; } , 100 ) ;
216+ setTimeout ( function ( ) { updateScrollbars ( cm . display , cm . doc . height , cm . options . fixedGutter ) ; } , 100 ) ;
216217 }
217218
218219 function estimateHeight ( cm ) {
@@ -317,7 +318,7 @@ window.CodeMirror = (function() {
317318
318319 // Re-synchronize the fake scrollbars with the actual size of the
319320 // content. Optionally force a scrollTop.
320- function updateScrollbars ( d /* display */ , docHeight ) {
321+ function updateScrollbars ( d /* display */ , docHeight , fixedGutter ) {
321322 var totalHeight = docHeight + paddingVert ( d ) ;
322323 d . sizer . style . minHeight = d . heightForcer . style . top = totalHeight + "px" ;
323324 var scrollHeight = Math . max ( totalHeight , d . scroller . scrollHeight ) ;
@@ -339,6 +340,11 @@ window.CodeMirror = (function() {
339340 d . scrollbarFiller . style . display = "block" ;
340341 d . scrollbarFiller . style . height = d . scrollbarFiller . style . width = scrollbarWidth ( d . measure ) + "px" ;
341342 } else d . scrollbarFiller . style . display = "" ;
343+ if ( needsH && fixedGutter ) {
344+ d . gutterFiller . style . display = "block" ;
345+ d . gutterFiller . style . height = scrollbarWidth ( d . measure ) + "px" ;
346+ d . gutterFiller . style . width = d . gutters . offsetWidth + "px" ;
347+ } else d . gutterFiller . style . display = "" ;
342348
343349 if ( mac_geLion && scrollbarWidth ( d . measure ) === 0 )
344350 d . scrollbarV . style . minWidth = d . scrollbarH . style . minHeight = mac_geMountainLion ? "18px" : "12px" ;
@@ -404,7 +410,7 @@ window.CodeMirror = (function() {
404410 signalLater ( cm , "viewportChange" , cm , cm . display . showingFrom , cm . display . showingTo ) ;
405411 } else break ;
406412 updateSelection ( cm ) ;
407- updateScrollbars ( cm . display , cm . doc . height ) ;
413+ updateScrollbars ( cm . display , cm . doc . height , cm . options . fixedGutter ) ;
408414
409415 // Clip forced viewport to actual scrollable area
410416 if ( viewPort )
@@ -1590,7 +1596,7 @@ window.CodeMirror = (function() {
15901596 var target = e_target ( e ) ;
15911597 if ( target == display . scrollbarH || target == display . scrollbarH . firstChild ||
15921598 target == display . scrollbarV || target == display . scrollbarV . firstChild ||
1593- target == display . scrollbarFiller ) return null ;
1599+ target == display . scrollbarFiller || target == display . gutterFiller ) return null ;
15941600 }
15951601 var x , y , space = getRect ( display . lineSpace ) ;
15961602 // Fails unpredictably on IE[67] when mouse is dragged around quickly.
0 commit comments