IJPL-164294 vcs marker: Fix scrolling and positioning of popup

IJ-MR-147690

GitOrigin-RevId: 20a8d077f497d0bcb58a46d9ba30f525b1af897a
This commit is contained in:
Aleksandr Krasilnikov
2024-10-28 21:37:38 +00:00
committed by intellij-monorepo-bot
parent f01b1e9813
commit 97d32070e4
3 changed files with 10 additions and 6 deletions
@@ -141,9 +141,14 @@ public class LineStatusMarkerPopupPanel extends JPanel {
// Space for horizontal scrollbar
size.height += JBUI.scale(20);
}
if (size.height > maxSize.height) {
size.height = maxSize.height;
Rectangle panelRect = new Rectangle(new Point(0, 0), size);
Rectangle rectangle = SwingUtilities.convertRectangle(this, panelRect, window);
if (rectangle.y + size.height > maxSize.height) {
size.height = maxSize.height - rectangle.y;
}
return size;
}
@@ -76,9 +76,7 @@ internal class LineStatusMarkerPopupService {
}
private fun showHint(hint: LightweightHint, editor: Editor, point: Point) {
val parent = editor.getComponent().rootPane
val hintHint = HintHint(editor, point)
hint.show(parent, point.x, point.y, editor.getComponent(), hintHint)
HintManagerImpl.doShowInGivenLocation(hint, editor, point, HintHint(editor, point), true)
}
companion object {
@@ -213,7 +213,8 @@ public class HintManagerImpl extends HintManager {
ClientHintManager.getCurrentInstance().showHint(component, p, flags, timeout, onHintHidden);
}
static void doShowInGivenLocation(final LightweightHint hint, final Editor editor, Point p, HintHint hintInfo, boolean updateSize) {
@ApiStatus.Internal
public static void doShowInGivenLocation(final LightweightHint hint, final Editor editor, Point p, HintHint hintInfo, boolean updateSize) {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
JComponent externalComponent = getExternalComponent(editor);