feat(hunk-mode): Add hunk mode (add to stage & revert block actions) #17
feat(hunk-mode): Add hunk mode (add to stage & revert block actions) #17fcmiranda wants to merge 1 commit into
Conversation
338529b to
adef2f5
Compare
|
@Blankeos Thank you for the feedback! I'm gonna work on this PR this week :) |
31ca81c to
29dfe08
Compare
- Add {/} always-on hunk navigation: selects hunk, centers view, wraps around
- Add hunk action markers in diff view (stage/revert tooltips)
- Add HunkActionKind, HunkActionUndoEntry for undo stack
- Add HunkMarkerStyle for customizable marker appearance
- Add stage hunk (a), revert hunk (r), undo last hunk action (u) keybindings
- Fix matches_key SHIFT modifier bug for non-alphabetic keys (e.g. {/})
- Remove explicit hunk mode (H key) — {/} always behaves like hunk mode
- Improve diff layout: divider width, content rendering adjustments
- Add smoke tests for hunk parsing
29dfe08 to
5816bd6
Compare
|
Hi fcmiranda! I really appreciate the changes! Sorry to be critical again... But have you checked
0.0.20-demo.mp4If the main purpose of this PR is just to add "Add hunk to staging"... Then I can imagine, that could just be a new item under the Hunk Actions dialog. What I don't like.
On a small window height with long diffs, the "first line" of the diff gets cut off, in favor of focusing the middle section. This is related to point 2.
Btw I found those issues in Point 4 with a simple What I like:
In any case...I really appreciate the contributions! I wouldn't want to bother you too... So if you're okay with it--I can just branch off of this PR and work on it further? Just let me know, thanks! |
|
@Blankeos, yes for sure! I'm sorry about the inconsistencies on the last PR update. Thanks for be critic, I like that, I prefer in this way to make better contributions in the future. Yes I like your idea of the small "a". Please go ahead you can branch this PR and finish it! Thanks for the pr-review tip I'm gonna add a skill or something for that :) |





Summary
Merges
feature/revert-block-cleanintofeature/hunk-mode, introducing a modal hunk mode for staging and reverting individual diff hunks via keyboard.screenrecording-2026-05-16_18-59-35.mp4
Hunk mode
Press
Hin the Files panel to enter hunk mode. While active:Hj/karuescMouse clicking a hunk marker selects it — then use
a/rto act on it.What's included
Henters hunk mode;j/kcycle hunks;escexits. Replaces the old{/}non-modal cycling.a) — stages the selected hunk from the worktree into the index viagit apply --cachedr) — reverts the selected hunk in the worktree viagit apply --reverseu) — undo stack stores the patch text + metadata; undo re-applies the inverse patch instead of restoring file bytes│(blends with the divider), bold on by default; selected state shows ``, hovered shows accent-secondary color. Colors follow the active border color by default.enterHunkMode,stageBlock,revertBlock,undoRevertBlockare all user-configurable inkeybindings.universalreset_keep_prefs()— dropped in main but still called by the diff-mode controller; preserves wrap/side-view prefs across navigationRemoved
{/}prev/next hunk keybindings (prevRevertBlock/nextRevertBlock) — hunk cycling is now exclusivelyj/kinside hunk modeConflict resolutions (hunk-mode priority)
src/config/keybindings.rs{/}fieldssrc/gui/mod.rsmatches_keyover hardcodedKeyCodehandlerssrc/gui/presentation/diff_mode.rssrc/gui/views.rssrc/pager/side_by_side.rsHunkMarkerStyle,HunkActionKind, patch-based undo; restoredreset_keep_prefs()