From 6503e00b690806728068a48d49b02066fd617231 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sun, 30 Jun 2024 19:04:53 +0800 Subject: [PATCH] Fix dropdown height. --- crates/ui/src/dropdown.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ui/src/dropdown.rs b/crates/ui/src/dropdown.rs index 73a50211..6611560d 100644 --- a/crates/ui/src/dropdown.rs +++ b/crates/ui/src/dropdown.rs @@ -1,7 +1,7 @@ use gpui::{ - actions, deferred, div, prelude::FluentBuilder as _, px, AnyElement, AppContext, DismissEvent, - Element, ElementId, EventEmitter, FocusHandle, FocusableView, InteractiveElement, IntoElement, - KeyBinding, LayoutId, ParentElement as _, Render, SharedString, + actions, deferred, div, prelude::FluentBuilder as _, px, rems, AnyElement, AppContext, + DismissEvent, Element, ElementId, EventEmitter, FocusHandle, FocusableView, InteractiveElement, + IntoElement, KeyBinding, LayoutId, ParentElement as _, Render, SharedString, StatefulInteractiveElement as _, Styled as _, View, ViewContext, VisualContext as _, WeakView, WindowContext, }; @@ -136,7 +136,11 @@ where selected_index: 0, }; - let picker = cx.new_view(|cx| Picker::uniform_list(picker_delegate, cx).no_query()); + let picker = cx.new_view(|cx| { + Picker::uniform_list(picker_delegate, cx) + .no_query() + .max_height(Some(rems(20.).into())) + }); Self { id: id.into(), focus_handle: cx.focus_handle(),