Skip to content

Conversation

@Simek
Copy link
Contributor

@Simek Simek commented Oct 9, 2025

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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 9, 2025
@cole-miller
Copy link
Member

Thanks for opening a PR!

However, note that it's intentional that we don't disable those buttons, see #26936 and the issue that's responding to. The thought is that when you're going through the hunks, you should be able to StageAndNext with the mouse even if a hunk is already staged. Otherwise, you'd have to move your mouse repeatedly back and forth between Stage and the down arrow button in the case where there are lots of hunks in a row that you want to keep, some of them already staged.

@Simek Simek force-pushed the @simek/git-ui-disable-stage-button-in-toolbar branch 2 times, most recently from 311ecc5 to 8413519 Compare October 10, 2025 06:52
@Simek
Copy link
Contributor Author

Simek commented Oct 10, 2025

Hey @cole-miller, thanks for the explanation and more context on that code! 🙏

I have change the code to achieve the initial part mentioned in "Why" section, so buttons being enabled with no local changes. I have used the combination of nav button and stage/unstage all, which should only disable them when both of those button are disabled, and retain the previous bechaviour when there are changes present.

Let me know what do you think about this approach, I'm also fine with closing this PR. 🙂

@Simek Simek force-pushed the @simek/git-ui-disable-stage-button-in-toolbar branch from 8413519 to dd932ed Compare October 10, 2025 06:59
@Simek Simek changed the title git_ui: Add missing disabled state for Uncommited Changes toolbar buttons git_ui: When no changes, disable stage/unstage toolbar buttons Oct 10, 2025
@cole-miller
Copy link
Member

Thanks!

@cole-miller cole-miller merged commit 59b87d5 into zed-industries:main Oct 20, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants