Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit 91e02be

Browse files
committed
Work around Webkit bug where sometimes the sizer gets the wrong width
(It'll leave space for a scrollbar to the right of the sizer, though the scroller does not actually have a scrollbar.) Issue #2420
1 parent ee9f33b commit 91e02be

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/codemirror.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@
652652
function setDocumentHeight(cm, measure) {
653653
cm.display.sizer.style.minHeight = cm.display.heightForcer.style.top = measure.docHeight + "px";
654654
cm.display.gutters.style.height = Math.max(measure.docHeight, measure.clientHeight - scrollerCutOff) + "px";
655+
// Work around Webkit bug where it sometimes reserves space for a
656+
// non-existing phantom scrollbar in the scroller (Issue #2420)
657+
if (webkit && cm.options.lineWrapping &&
658+
cm.display.sizer.offsetWidth + cm.display.gutters.offsetWidth < cm.display.scroller.clientWidth - 1) {
659+
cm.display.sizer.style.minHeight = cm.display.heightForcer.style.top = "0px";
660+
cm.display.gutters.style.height = measure.docHeight + "px";
661+
}
655662
}
656663

657664
// Read the actual heights of the rendered lines, and update their

0 commit comments

Comments
 (0)