Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command for resetting diff hunks #5736

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

pascalkuthe
Copy link
Member

@pascalkuthe pascalkuthe commented Jan 30, 2023

Closes #4974

Adds the :reset-diff-change command (aliases :diffg and :diffget) that resets a hunk back
to its original text.

This change requires exposing the diff_base (the file that a diff was computed against). To accommodate that I slightly refactored the terminology the DiffHandle and renamed the FileHunks struct to Diff as it doesn't just contains hunks anymore.

@pascalkuthe pascalkuthe added C-enhancement Category: Improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate S-waiting-on-review Status: Awaiting review from a maintainer. A-vcs Area: Version control system interaction labels Jan 30, 2023
@trink
Copy link
Contributor

trink commented Jan 30, 2023

The diagnostics get confused by the reset. It just pushed the diagnostic down and I have to save the file to clear it. Although this isn't specific to reset, it is just easier to demonstrate here.

Peek 2023-01-30 11-39

@pascalkuthe
Copy link
Member Author

The diagnostics get confused by the reset. It just pushed the diagnostic down and I have to save the file to clear it. Although this isn't specific to reset, it is just easier to demonstrate here.

Peek 2023-01-30 11-39 Peek 2023-01-30 11-39

That's just #701 and happens for any edit not just the :reset-change command here (also the case on master) so unrelated to this PR.

@pascalkuthe pascalkuthe force-pushed the diff-reset branch 3 times, most recently from 4f688f6 to ff2a750 Compare February 6, 2023 16:25
the-mikedavis
the-mikedavis previously approved these changes Feb 6, 2023
@archseer archseer merged commit 48b6aa9 into helix-editor:master Mar 8, 2023
sagnibak pushed a commit to sagnibak/helix that referenced this pull request Mar 21, 2023
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
@pascalkuthe pascalkuthe deleted the diff-reset branch April 25, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: Version control system interaction C-enhancement Category: Improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command to reset diff hunks
5 participants