From 2f415856477567499ab4047fa882f7477e0d44b9 Mon Sep 17 00:00:00 2001 From: Sergei Tachenov Date: Thu, 14 Nov 2024 16:11:12 +0200 Subject: [PATCH] IJPL-171475 Fix the fit-to-screen logic in AbstractPopup The existing logic didn't take coordinates into account. A popup may be smaller than the screen, but shifted so that it doesn't fit anyway. (cherry picked from commit 945d7a60730508eb3d68f257c95d3833d68846d1) IJ-CR-149457 GitOrigin-RevId: c2874c7d61f524c183d8f1451408d64e0d8db356 --- .../src/com/intellij/ui/popup/AbstractPopup.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index f93a2d53d5e0..8b233be5fe75 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -1370,7 +1370,12 @@ public class AbstractPopup implements JBPopup, ScreenAreaConsumer, AlignedPopup PopupLocationTracker.register(this); - if (bounds.width > screen.width || bounds.height > screen.height) { + if ( + bounds.x < screen.x || + bounds.y < screen.y || + bounds.x + bounds.width > screen.x + screen.width || + bounds.y + bounds.height > screen.y + screen.height + ) { if (LOG.isDebugEnabled()) { LOG.debug("Bounds won't fit into the screen, adjusting"); }