Skip to content

Commit 59b87d5

Browse files
authored
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. <img width="1628" height="656" alt="Screenshot 2025-10-10 at 00 49 06" src="https://github.com/user-attachments/assets/6bdb9ded-17c8-4f84-8649-b297162c1992" /> # 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 <img width="1728" height="772" alt="Screenshot 2025-10-10 at 08 40 14" src="https://github.com/user-attachments/assets/ff41d852-974e-4ce1-9163-ecd30e17d5d8" />
1 parent fd4682c commit 59b87d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

crates/git_ui/src/project_diff.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,11 @@ impl Render for ProjectDiffToolbar {
947947
&StageAndNext,
948948
&focus_handle,
949949
))
950+
.disabled(
951+
!button_states.prev_next
952+
&& !button_states.stage_all
953+
&& !button_states.unstage_all,
954+
)
950955
.on_click(cx.listener(|this, _, window, cx| {
951956
this.dispatch_action(&StageAndNext, window, cx)
952957
})),
@@ -958,6 +963,11 @@ impl Render for ProjectDiffToolbar {
958963
&UnstageAndNext,
959964
&focus_handle,
960965
))
966+
.disabled(
967+
!button_states.prev_next
968+
&& !button_states.stage_all
969+
&& !button_states.unstage_all,
970+
)
961971
.on_click(cx.listener(|this, _, window, cx| {
962972
this.dispatch_action(&UnstageAndNext, window, cx)
963973
})),

0 commit comments

Comments
 (0)