From d3b55761013b7d9b52c004ef4c02c3d9f642aeaa Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke <marijnh@gmail.com> Date: Sun, 27 Mar 2011 09:53:08 +0200 Subject: [PATCH] make the position of nodes added with addWidget more stable --- lib/codemirror.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/codemirror.js b/lib/codemirror.js index b0e38c21..390e68c1 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -143,8 +143,9 @@ var CodeMirror = (function() { lineInfo: lineInfo, addWidget: function(pos, node, scroll) { var pos = localCoords(clipPos(pos), true); - node.style.top = pos.yBot + "px"; node.style.left = pos.x + "px"; - lineSpace.appendChild(node); + node.style.top = (showingFrom * lineHeight() + pos.yBot + paddingTop()) + "px"; + node.style.left = (pos.x + paddingLeft()) + "px"; + code.appendChild(node); if (scroll) scrollIntoView(pos.x, pos.yBot, pos.x + node.offsetWidth, pos.yBot + node.offsetHeight); }, -- GitLab