Skip to content

Feature: Revert block#12

Closed
fcmiranda wants to merge 1 commit into
Blankeos:mainfrom
fcmiranda:feature/revert-block
Closed

Feature: Revert block#12
fcmiranda wants to merge 1 commit into
Blankeos:mainfrom
fcmiranda:feature/revert-block

Conversation

@fcmiranda
Copy link
Copy Markdown
Contributor

@fcmiranda fcmiranda commented Apr 29, 2026

Summary

Adds a revert-block feature to the side-by-side diff view: individual hunks can be reverted directly from the diff pane using keyboard navigation. Also ships configurable borders and gutter improvements that were needed as prerequisites.

Changes

feat: add revert block on git diff

The main feature commit. Adds the ability to revert individual diff hunks directly in the diff pane:

  • Introduces selected_revert_hunk: Option<usize> in DiffViewState to track the focused hunk.
  • Computes hunk_starts during diff parsing so each hunk's screen row is known.
  • Renders a ▶ revert button glyph on the right edge of each hunk's header row; the selected hunk's button is highlighted in the accent colour.
  • Adds a revert_hunk action in keybindings.rs and wires it up in the file controller to apply a reverse patch via git apply --reverse.
  • Preserves selected_revert_hunk across file-selection changes within the same file.

#8

- Adjusted import order and formatting in `file_tree.rs` for clarity.
- Enhanced readability in `cmd.rs` by aligning method chaining and improving context messages.
- Cleaned up imports and formatting in `diff_algo.rs` for better organization.
- Reformatted function signatures and method chaining in `highlight/mod.rs` for consistency.
- Updated `side_by_side.rs` to improve layout handling and added functionality for revert markers.
- Introduced new methods in `DiffViewState` for managing revertable hunks and improved gutter highlighting.
- Enhanced rendering logic in `render_diff` to support new features and maintain consistent styling.
@fcmiranda fcmiranda changed the title Refactor code for improved readability and consistency Feature: Revert block Apr 30, 2026
@fcmiranda fcmiranda marked this pull request as draft April 30, 2026 09:44
@fcmiranda fcmiranda closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant