From 231fd1c5c094549852df62117cebe3a70a229935 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 3 Jan 2024 11:41:15 -0500 Subject: [PATCH] Clip completion labels when they would otherwise overflow their container Co-Authored-By: Julia --- crates/editor2/src/editor.rs | 2 +- crates/ui2/src/components/list/list_item.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 8f15ca88ea28e796630bc978cd86c2a773221ca2..ffdfe3f975b56ca114bfe3911c3dc8f0eacd47ba 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -1266,7 +1266,7 @@ impl CompletionsMenu { ) .map(|task| task.detach_and_log_err(cx)); })) - .child(completion_label) + .child(h_stack().overflow_hidden().child(completion_label)) .end_slot::
(documentation_label), ) }) diff --git a/crates/ui2/src/components/list/list_item.rs b/crates/ui2/src/components/list/list_item.rs index 403c24b8e52344ac53b295cc10ac9811e3150313..88ade283cc40a34b1ad3b40aa5db6c1a531f37fd 100644 --- a/crates/ui2/src/components/list/list_item.rs +++ b/crates/ui2/src/components/list/list_item.rs @@ -224,6 +224,9 @@ impl RenderOnce for ListItem { })) .child( h_stack() + // HACK: We need to set *any* width value here in order for this container to size correctly. + // Without this the `h_stack` will overflow the parent `inner_list_item`. + .w_px() .flex_1() .gap_1() .children(self.start_slot)