From 75f56c3d7449d2941ad10ae663113aee2da17fb2 Mon Sep 17 00:00:00 2001 From: alirrah Date: Mon, 23 Jun 2025 20:50:50 +0330 Subject: [PATCH] fix bug in show-hints inset --- addon/hint/show-hint.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addon/hint/show-hint.js b/addon/hint/show-hint.js index aaf1f643f4..adb523facc 100644 --- a/addon/hint/show-hint.js +++ b/addon/hint/show-hint.js @@ -255,6 +255,7 @@ } var container = completion.options.container || ownerDocument.body; + var marginBottom = completion.options.marginBottom || 0; var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null); var left = pos.left, top = pos.bottom, below = true; var offsetLeft = 0, offsetTop = 0; @@ -285,12 +286,12 @@ var startScroll; setTimeout(function() { startScroll = cm.getScrollInfo(); }); - var overlapY = box.bottom - winH; + var overlapY = box.bottom + marginBottom - winH; if (overlapY > 0) { // Does not fit below var height = box.bottom - box.top, spaceAbove = box.top - (pos.bottom - pos.top) - 2 if (winH - box.top < spaceAbove) { // More room at the top if (height > spaceAbove) hints.style.height = (height = spaceAbove) + "px"; - hints.style.top = ((top = pos.top - height) + offsetTop) + "px"; + hints.style.top = ((top = pos.top - height) - offsetTop) + "px"; below = false; } else { hints.style.height = (winH - box.top - 2) + "px";