git: Make repo selector wider (#26149)
…m_item() Closes #ISSUE Release Notes: - git: Fixed repository selector being too narrow
This commit is contained in:
parent
f13b2fd811
commit
2a919ad1d0
2 changed files with 29 additions and 6 deletions
|
@ -48,6 +48,7 @@ pub struct Picker<D: PickerDelegate> {
|
|||
pending_update_matches: Option<PendingUpdateMatches>,
|
||||
confirm_on_update: Option<bool>,
|
||||
width: Option<Length>,
|
||||
widest_item: Option<usize>,
|
||||
max_height: Option<Length>,
|
||||
focus_handle: FocusHandle,
|
||||
/// An external control to display a scrollbar in the `Picker`.
|
||||
|
@ -283,6 +284,7 @@ impl<D: PickerDelegate> Picker<D> {
|
|||
pending_update_matches: None,
|
||||
confirm_on_update: None,
|
||||
width: None,
|
||||
widest_item: None,
|
||||
max_height: Some(rems(18.).into()),
|
||||
focus_handle,
|
||||
show_scrollbar: false,
|
||||
|
@ -332,6 +334,11 @@ impl<D: PickerDelegate> Picker<D> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn widest_item(mut self, ix: Option<usize>) -> Self {
|
||||
self.widest_item = ix;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn max_height(mut self, max_height: Option<gpui::Length>) -> Self {
|
||||
self.max_height = max_height;
|
||||
self
|
||||
|
@ -690,6 +697,9 @@ impl<D: PickerDelegate> Picker<D> {
|
|||
},
|
||||
)
|
||||
.with_sizing_behavior(sizing_behavior)
|
||||
.when_some(self.widest_item, |el, widest_item| {
|
||||
el.with_width_from_item(Some(widest_item))
|
||||
})
|
||||
.flex_grow()
|
||||
.py_1()
|
||||
.track_scroll(scroll_handle.clone())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue