Fix alignment in git blame gutter (#10067)
Fixes #9977. Instead of doing nasty string alignment, this now uses the layout engine.  Release Notes: - N/A
This commit is contained in:
parent
b43602f21b
commit
84cca62b2e
1 changed files with 8 additions and 7 deletions
|
@ -2909,17 +2909,14 @@ fn render_blame_entry(
|
||||||
let pretty_commit_id = format!("{}", blame_entry.sha);
|
let pretty_commit_id = format!("{}", blame_entry.sha);
|
||||||
let short_commit_id = pretty_commit_id.clone().chars().take(6).collect::<String>();
|
let short_commit_id = pretty_commit_id.clone().chars().take(6).collect::<String>();
|
||||||
|
|
||||||
let name = blame_entry.author.as_deref().unwrap_or("<no name>");
|
let author_name = blame_entry.author.as_deref().unwrap_or("<no name>");
|
||||||
let name = if name.len() > 20 {
|
let name = util::truncate_and_trailoff(author_name, 20);
|
||||||
format!("{}...", &name[..16])
|
|
||||||
} else {
|
|
||||||
name.to_string()
|
|
||||||
};
|
|
||||||
|
|
||||||
let permalink = blame.read(cx).permalink_for_entry(&blame_entry);
|
let permalink = blame.read(cx).permalink_for_entry(&blame_entry);
|
||||||
let commit_message = blame.read(cx).message_for_entry(&blame_entry);
|
let commit_message = blame.read(cx).message_for_entry(&blame_entry);
|
||||||
|
|
||||||
h_flex()
|
h_flex()
|
||||||
|
.w_full()
|
||||||
.font(text_style.font().family)
|
.font(text_style.font().family)
|
||||||
.line_height(text_style.line_height)
|
.line_height(text_style.line_height)
|
||||||
.id(("blame", ix))
|
.id(("blame", ix))
|
||||||
|
@ -2929,8 +2926,12 @@ fn render_blame_entry(
|
||||||
.child(short_commit_id)
|
.child(short_commit_id)
|
||||||
.mr_2(),
|
.mr_2(),
|
||||||
div()
|
div()
|
||||||
|
.w_full()
|
||||||
|
.h_flex()
|
||||||
|
.justify_between()
|
||||||
.text_color(cx.theme().status().hint)
|
.text_color(cx.theme().status().hint)
|
||||||
.child(format!("{:20} {: >14}", name, relative_timestamp)),
|
.child(name)
|
||||||
|
.child(relative_timestamp),
|
||||||
])
|
])
|
||||||
.on_mouse_down(MouseButton::Right, {
|
.on_mouse_down(MouseButton::Right, {
|
||||||
let blame_entry = blame_entry.clone();
|
let blame_entry = blame_entry.clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue