Prevent branch name overflow in git panel selection (#33529)
Closes #33527 Release Notes: - Fixed long branch names overflowing to multiple lines in git panel branch selector --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
695118d110
commit
c56b8904cc
1 changed files with 27 additions and 28 deletions
|
@ -245,7 +245,7 @@ impl PickerDelegate for BranchListDelegate {
|
|||
type ListItem = ListItem;
|
||||
|
||||
fn placeholder_text(&self, _window: &mut Window, _cx: &mut App) -> Arc<str> {
|
||||
"Select branch...".into()
|
||||
"Select branch…".into()
|
||||
}
|
||||
|
||||
fn editor_position(&self) -> PickerEditorPosition {
|
||||
|
@ -439,44 +439,43 @@ impl PickerDelegate for BranchListDelegate {
|
|||
})
|
||||
.unwrap_or_else(|| (None, None));
|
||||
|
||||
let branch_name = if entry.is_new {
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Icon::new(IconName::Plus)
|
||||
.size(IconSize::Small)
|
||||
.color(Color::Muted),
|
||||
)
|
||||
.child(
|
||||
Label::new(format!("Create branch \"{}\"…", entry.branch.name()))
|
||||
.single_line()
|
||||
.truncate(),
|
||||
)
|
||||
.into_any_element()
|
||||
} else {
|
||||
HighlightedLabel::new(entry.branch.name().to_owned(), entry.positions.clone())
|
||||
.truncate()
|
||||
.into_any_element()
|
||||
};
|
||||
|
||||
Some(
|
||||
ListItem::new(SharedString::from(format!("vcs-menu-{ix}")))
|
||||
.inset(true)
|
||||
.spacing(match self.style {
|
||||
BranchListStyle::Modal => ListItemSpacing::default(),
|
||||
BranchListStyle::Popover => ListItemSpacing::ExtraDense,
|
||||
})
|
||||
.spacing(ListItemSpacing::Sparse)
|
||||
.toggle_state(selected)
|
||||
.child(
|
||||
v_flex()
|
||||
.w_full()
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
h_flex()
|
||||
.w_full()
|
||||
.flex_shrink()
|
||||
.overflow_x_hidden()
|
||||
.gap_2()
|
||||
.gap_6()
|
||||
.justify_between()
|
||||
.child(div().flex_shrink().overflow_x_hidden().child(
|
||||
if entry.is_new {
|
||||
Label::new(format!(
|
||||
"Create branch \"{}\"…",
|
||||
entry.branch.name()
|
||||
))
|
||||
.single_line()
|
||||
.into_any_element()
|
||||
} else {
|
||||
HighlightedLabel::new(
|
||||
entry.branch.name().to_owned(),
|
||||
entry.positions.clone(),
|
||||
)
|
||||
.truncate()
|
||||
.into_any_element()
|
||||
},
|
||||
))
|
||||
.when_some(commit_time, |el, commit_time| {
|
||||
el.child(
|
||||
.overflow_x_hidden()
|
||||
.child(branch_name)
|
||||
.when_some(commit_time, |label, commit_time| {
|
||||
label.child(
|
||||
Label::new(commit_time)
|
||||
.size(LabelSize::Small)
|
||||
.color(Color::Muted)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue