From 59b87d5c71a51d2b981ba86f694212a748b33120 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Mon, 20 Oct 2025 04:21:21 +0200 Subject: [PATCH] git_ui: When no changes, disable stage/unstage toolbar buttons (#39909) # Why While working on recent PR I have spotted that "Stage" and "Unstage" buttons in "Uncommited Changes" toolbar are always active, even when there is no changes made locally. Screenshot 2025-10-10 at 00 49 06 # How Re-use already existing button states for managing the disabled state of "Uncommited Changes" toolbar buttons when changeset is empty. Release Notes: - Added disabled state for "Uncommited Changes" toolbar buttons when there are no changes present # Preview Screenshot 2025-10-10 at 08 40 14 --- crates/git_ui/src/project_diff.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index e0eda7d8bef40ae622eb03b2df981d28d61de5d0..5cd2e5e3b07bb8bf503cada7f0ca2f8dd0388a4e 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) })),