Implement comprehensive interactive staging functionality that allows users to stage and unstage individual lines, similar to `git add -p` but with a visual interface. New features: - Split view mode showing unstaged changes (left) and staged changes (right) - Line-by-line staging: press Space on any diff line to stage/unstage it - Tab switching between unstaged and staged panes - Apply staged changes with 'a' key (runs `git apply --cached`) - Visual indicators for staged vs unstaged content with proper syntax highlighting - Interactive unstaging: switch to staged pane and press Space to unstage lines - Automatic refresh of git status after staging/unstaging operations - Proper git integration reading from both working directory and staging area Technical implementation: - Added `load_file_with_staging_info()` to load unstaged changes (staging vs working) - Added `rebuild_staged_view_from_git()` to load staged changes (HEAD vs staging) - Added `stage_hunk_by_line()` for individual line staging - Added `unstage_line_from_git()` for removing lines from staging area - Added `apply_staged_changes()` to apply staged content to git - Enhanced file content window with split view rendering - Added proper cursor management for both unstaged and staged panes This transforms the diff viewer into a full-featured interactive staging tool, allowing developers to create atomic commits with only specific lines rather than entire files. Keybindings: - Enter: Switch to split staging view - Tab: Switch between unstaged/staged panes - Space: Stage/unstage current line - 'a': Apply staged changes to git - 'c': Commit staged changes - 'r': Reset staged changes
173 KiB
173 KiB