Skip to content

feat(tui): patch hunk picking#13165

Merged
davidpdrsn merged 15 commits intomasterfrom
dp-patch-hunk-picking
Apr 2, 2026
Merged

feat(tui): patch hunk picking#13165
davidpdrsn merged 15 commits intomasterfrom
dp-patch-hunk-picking

Conversation

@davidpdrsn
Copy link
Copy Markdown
Contributor

@davidpdrsn davidpdrsn commented Apr 2, 2026

Adds support for moving hunks from the diff viewer to commits, branches, etc.

Diff is big because all the snapshots have changed.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Apr 2, 2026 8:20pm

Request Review

@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Apr 2, 2026
@davidpdrsn davidpdrsn requested a review from Copilot April 2, 2026 20:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “patch hunk picking” support in the legacy status TUI by enabling operations that move individual diff hunks from the details/diff viewer into commits, stacks/branches, or unassigned, with updated navigation/keybindings and refreshed TUI snapshots.

Changes:

  • Introduces committed-hunk routing/execution logic to move a selected hunk to a commit/stack/unassigned and integrates it into Rub flow.
  • Adds/extends TUI modes & keybindings (notably a dedicated Details mode) and cursor helpers to keep selections visible during navigation.
  • Updates tests and SVG snapshots to reflect the new UI behavior/rendering and selection/scrolling behavior.

Reviewed changes

Copilot reviewed 15 out of 103 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/but/src/command/legacy/status/tui/tests/utils.rs Snapshot rendering normalization updates (incl. detecting long hashes) and cursor color deref adjustment.
crates/but/src/command/legacy/status/tui/tests/snapshots/inline_reword_renders_on_visible_row_when_scrolled_001.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/inline_reword_004.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/inline_reword_003.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/focus_reload_in_branch_mode_preserves_merge_base_selection_final.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/focus_reload_in_branch_mode_preserves_branch_selection_final.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/entering_branch_mode_closes_global_file_list_final.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_003.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_002.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_message_wraps_in_details_view_001.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_success_002.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/command_mode_success_001.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/snapshots/branch_mode_from_unassigned_jumps_to_first_branch_final.svg Updated snapshot output reflecting new UI rendering/hotbar details.
crates/but/src/command/legacy/status/tui/tests/rub_tests.rs Updates Rub tests for new operation display/behavior.
crates/but/src/command/legacy/status/tui/tests/mod.rs Adds a regression test for branch-mode scrolling visibility and adjusts a TUI height in an existing test.
crates/but/src/command/legacy/status/tui/rub_from_detail_view.rs New routing/execution logic for moving committed hunks from the details view to other targets.
crates/but/src/command/legacy/status/tui/rub_api.rs Tightens handling of “new_commit” results (now errors when missing) for certain operations.
crates/but/src/command/legacy/status/tui/mode.rs Adds Details mode styling helpers and introduces RubSource::CommittedHunk / CommittedHunk types.
crates/but/src/command/legacy/status/tui/message_on_drop.rs Adds an RAII guard to emit cleanup/unlock messages on drop.
crates/but/src/command/legacy/status/tui/key_bind.rs Refactors global binds registration, adds Details-mode binds, and updates mode-specific binds.
crates/but/src/command/legacy/status/tui/fps.rs Adds an FPS counter utility.
crates/but/src/command/legacy/status/tui/event_polling.rs Adds an event polling abstraction (real vs noop) to support non-interactive runs/testing.
crates/but/src/command/legacy/status/tui/details/details_cursor.rs Adds a cursor/selection helper for details sections.
crates/but/src/command/legacy/status/tui/cursor/tests.rs Updates cursor tests for the new RubSource/RubMode shape.
crates/but/src/command/legacy/status/tui/cursor/mod.rs Adds select_stack helper and extends selection logic to account for Details mode and RubSource comparisons.
crates/but/Cargo.toml Adds uuid to dependencies (used by details view code).
Cargo.lock Lockfile update for the added dependency.

Comment thread crates/but/src/command/legacy/status/tui/cursor/mod.rs
Comment thread crates/but/src/command/legacy/status/tui/rub_api.rs
Comment thread crates/but/src/command/legacy/status/tui/rub_api.rs
Comment thread crates/but/src/command/legacy/status/tui/key_bind.rs
@davidpdrsn davidpdrsn marked this pull request as ready for review April 2, 2026 20:43
@davidpdrsn davidpdrsn merged commit cc55f43 into master Apr 2, 2026
47 checks passed
@davidpdrsn davidpdrsn deleted the dp-patch-hunk-picking branch April 2, 2026 20:43
@davidpdrsn davidpdrsn mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants