mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
Space in the focused main view now acts on the selected lines the way it does in the staging view: over the working tree's unstaged changes it puts them into the index, and over the staged ones it takes them back out. Which of the two it does is a property of the pane, each side of the diff having one of its own. Nothing has to be entered first, and a selection reaching across several files of a directory's diff is applied as one patch per file. The rows on screen are only a picture of the diff, so the patch is built from the diff itself: each selected row's identity — which file, which line of it, and whether it is a deletion — is looked for in the file's own diff, and the lines that match are the ones the patch includes. Matching by position rather than by counting rows is what tells the two halves of a modified line apart, since the deletion and the addition replacing it sit at the same place in the new file. Panels other than the working tree offer no action on their diff yet, so space says nothing and does nothing there. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>