From f15ad9523db1ea73f483ea93a3000de72d1b587c Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Sun, 4 Jul 2021 11:28:16 +0200 Subject: [PATCH] LibGUI: Fix `go_upwards_instead` check in ComboBox This change addresses an issue where ComboBox list window would always be drawn upwards if the number of elements is lower or equal 3. --- Userland/Libraries/LibGUI/ComboBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index ced858b853..bb03e42acb 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -238,7 +238,7 @@ void ComboBox::open() // Change direction and go upwards to prevent the list from becoming // infinitesimally small when pushed up against the screen edge. auto minimum_height = min(3, model()->row_count()) * m_list_view->item_height() + m_list_view->frame_thickness() * 2; - bool go_upwards_instead = list_window_rect.height() <= minimum_height; + bool go_upwards_instead = list_window_rect.height() < minimum_height; if (go_upwards_instead) { auto origin_point = my_screen_rect.top_left(); list_window_rect = { Gfx::IntPoint { origin_point.x(), origin_point.y() - size.height() }, size };