Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git_panel: Fix empty state label not align to center (#55235)

Dongdc5af1de6448
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index f0900b56bcc..d2cc266e0f2 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -4824,7 +4824,13 @@ impl GitPanel {
}
fn render_no_changes_ui(&self, cx: &Context<Self>) -> Vec<AnyElement> {
- let mut elements: Vec<AnyElement> = vec!["No changes to commit".into_any_element()];
+ let mut elements: Vec<AnyElement> = vec![
+ div()
+ .self_stretch()
+ .text_center()
+ .child("No changes to commit")
+ .into_any_element(),
+ ];
if self.changes_count == 0 && !self.is_on_main_branch(cx) {
elements.push(
@@ -4906,7 +4912,11 @@ impl GitPanel {
let worktree_count = self.project.read(cx).visible_worktrees(cx).count();
if worktree_count > 0 && self.active_repository.is_none() {
vec![
- "No Git Repositories".into_any_element(),
+ div()
+ .self_stretch()
+ .text_center()
+ .child("No Git Repositories")
+ .into_any_element(),
panel_filled_button("Initialize Repository")
.tooltip(Tooltip::for_action_title_in(
"git init",