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_ui: When no changes, disable stage/unstage toolbar buttons (#39909)

Bartosz Kaszubowski59b87d5c71a5
diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs
index e0eda7d8bef..5cd2e5e3b07 100644
--- a/crates/git_ui/src/project_diff.rs
+++ b/crates/git_ui/src/project_diff.rs
@@ -947,6 +947,11 @@ impl Render for ProjectDiffToolbar {
&StageAndNext,
&focus_handle,
))
+ .disabled(
+ !button_states.prev_next
+ && !button_states.stage_all
+ && !button_states.unstage_all,
+ )
.on_click(cx.listener(|this, _, window, cx| {
this.dispatch_action(&StageAndNext, window, cx)
})),
@@ -958,6 +963,11 @@ impl Render for ProjectDiffToolbar {
&UnstageAndNext,
&focus_handle,
))
+ .disabled(
+ !button_states.prev_next
+ && !button_states.stage_all
+ && !button_states.unstage_all,
+ )
.on_click(cx.listener(|this, _, window, cx| {
this.dispatch_action(&UnstageAndNext, window, cx)
})),