Skip to content

Commit d3b5576

Browse files
committed
make the position of nodes added with addWidget more stable
1 parent 8e146ce commit d3b5576

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/codemirror.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ var CodeMirror = (function() {
143143
lineInfo: lineInfo,
144144
addWidget: function(pos, node, scroll) {
145145
var pos = localCoords(clipPos(pos), true);
146-
node.style.top = pos.yBot + "px"; node.style.left = pos.x + "px";
147-
lineSpace.appendChild(node);
146+
node.style.top = (showingFrom * lineHeight() + pos.yBot + paddingTop()) + "px";
147+
node.style.left = (pos.x + paddingLeft()) + "px";
148+
code.appendChild(node);
148149
if (scroll)
149150
scrollIntoView(pos.x, pos.yBot, pos.x + node.offsetWidth, pos.yBot + node.offsetHeight);
150151
},

0 commit comments

Comments
 (0)