Skip to content

Commit 89ae5d2

Browse files
committed
Use CSS min-height to ensure gutter covers whole view
Issue codemirror#3884
1 parent 0814679 commit 89ae5d2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/codemirror.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
191191

192192
.CodeMirror-gutters {
193193
position: absolute; left: 0; top: 0;
194+
min-height: 100%;
194195
z-index: 3;
195196
}
196197
.CodeMirror-gutter {

lib/codemirror.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,8 @@
763763
updateHeightsInViewport(cm);
764764
var barMeasure = measureForScrollbars(cm);
765765
updateSelection(cm);
766-
setDocumentHeight(cm, barMeasure);
767766
updateScrollbars(cm, barMeasure);
767+
setDocumentHeight(cm, barMeasure);
768768
}
769769

770770
update.signal(cm, "update", cm);
@@ -781,17 +781,16 @@
781781
postUpdateDisplay(cm, update);
782782
var barMeasure = measureForScrollbars(cm);
783783
updateSelection(cm);
784-
setDocumentHeight(cm, barMeasure);
785784
updateScrollbars(cm, barMeasure);
785+
setDocumentHeight(cm, barMeasure);
786786
update.finish();
787787
}
788788
}
789789

790790
function setDocumentHeight(cm, measure) {
791791
cm.display.sizer.style.minHeight = measure.docHeight + "px";
792792
cm.display.heightForcer.style.top = measure.docHeight + "px";
793-
cm.display.gutters.style.height = Math.max(measure.docHeight + cm.display.barHeight + scrollGap(cm),
794-
measure.clientHeight) + "px";
793+
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
795794
}
796795

797796
// Read the actual heights of the rendered lines, and update their
@@ -3116,10 +3115,10 @@
31163115

31173116
if (op.preparedSelection)
31183117
cm.display.input.showSelection(op.preparedSelection);
3119-
if (op.updatedDisplay)
3120-
setDocumentHeight(cm, op.barMeasure);
31213118
if (op.updatedDisplay || op.startHeight != cm.doc.height)
31223119
updateScrollbars(cm, op.barMeasure);
3120+
if (op.updatedDisplay)
3121+
setDocumentHeight(cm, op.barMeasure);
31233122

31243123
if (op.selectionChanged) restartBlink(cm);
31253124

0 commit comments

Comments
 (0)