From 2761c809bec8b4d5a3f46d14f626a7386fdebb71 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Tue, 5 Jul 2011 09:47:02 +0200 Subject: [PATCH] Fix feedback loop between code.style.width and lineSpace.offsetWidth This would be visible in the activeline demo, where the colored line would get shorter and shorter for each display update. --- lib/codemirror.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/codemirror.js b/lib/codemirror.js index 9d961105f4..8b16242e12 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -767,7 +767,7 @@ var CodeMirror = (function() { var textWidth = stringWidth(maxLine); lineSpace.style.width = textWidth > scroller.clientWidth ? textWidth + "px" : ""; // Needed to prevent odd wrapping/hiding of widgets placed in here. - code.style.width = (lineSpace.offsetWidth + lineSpace.offsetLeft) + "px"; + code.style.width = scroller.scrollWidth + "px"; // Since this is all rather error prone, it is honoured with the // only assertion in the whole file.