From 9599ab55b32c9febcca98413cf5e45febcd6c0d5 Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Wed, 22 Apr 2026 13:36:17 +0200 Subject: [PATCH] Fix `PopupMenu` using the wrong separation when searching/filtering --- scene/gui/popup_menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 11894609fd..868e06d36a 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -915,13 +915,15 @@ void PopupMenu::_draw_items() { Point2 ofs; // Loop through all items and draw each. + bool first_visible = true; for (int i = 0; i < items.size(); i++) { if (!items[i].visible) { continue; } - // For the first item only add half a separation. For all other items, add a whole separation to the offset. - ofs.y += i > 0 ? theme_cache.v_separation : theme_cache.v_separation / 2; + // For the first visible item only add half a separation. For all other items, add a whole separation to the offset. + ofs.y += first_visible ? theme_cache.v_separation / 2 : theme_cache.v_separation; + first_visible = false; _shape_item(i);