Skip to content

Commit 6a84559

Browse files
committed
[show-hint addon] Move call to getScrollInto to avoid a reflow
1 parent 34b3a7b commit 6a84559

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

addon/hint/show-hint.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@
230230
(completion.options.container || document.body).appendChild(hints);
231231
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
232232
var scrolls = hints.scrollHeight > hints.clientHeight + 1
233+
var startScroll = cm.getScrollInfo();
234+
233235
if (overlapY > 0) {
234236
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
235237
if (curTop - height > 0) { // Fits above cursor
@@ -273,7 +275,6 @@
273275
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
274276
}
275277

276-
var startScroll = cm.getScrollInfo();
277278
cm.on("scroll", this.onScroll = function() {
278279
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
279280
var newTop = top + startScroll.top - curScroll.top;

0 commit comments

Comments
 (0)