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.

Show a disabled stage all button for no entries (#26436)

Conrad Irwin42c655751b53
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 2b05beee095..15f2a02dcc4 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -2451,7 +2451,7 @@ impl GitPanel {
let text;
let action;
let tooltip;
- if self.total_staged_count() == self.entry_count {
+ if self.total_staged_count() == self.entry_count && self.entry_count > 0 {
text = "Unstage All";
action = git::UnstageAll.boxed_clone();
tooltip = "git reset";
@@ -2492,6 +2492,7 @@ impl GitPanel {
action.as_ref(),
&self.focus_handle,
))
+ .disabled(self.entry_count == 0)
.on_click(move |_, _, cx| {
let action = action.boxed_clone();
cx.defer(move |cx| {