jesseduffield.lazygit/pkg/commands/patch
Stefan Haller c9c1fb6a0b Add old-file-space patch arithmetic for landing on deletions
The patch package can already map a patch line index to its new-file line
number and back (LineNumberOfLine / PatchLineForLineNumber). The diff-line
parser being built on top of this needs the old-file equivalents: a deletion
has no distinct new-file position (two consecutive deletions share one), so to
land on the exact deletion when diving into staging we have to look it up by
old-file line number.

Add OldLineNumberOfLine and PatchLineForOldLineNumber as direct mirrors of the
new-file functions, counting DELETION+CONTEXT lines instead of ADDITION+CONTEXT.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-08 12:58:59 +02:00
..
format.go Export PatchLine.isChange 2025-07-04 10:14:35 +02:00
hunk.go refactor patch code 2023-03-19 16:30:39 +11:00
parse.go refactor patch code 2023-03-19 16:30:39 +11:00
patch.go Add old-file-space patch arithmetic for landing on deletions 2026-08-08 12:58:59 +02:00
patch_builder.go Guard the patch builder against concurrent access 2026-07-17 12:35:54 +02:00
patch_line.go Fix selection after staging an added line 2026-03-19 16:57:53 +01:00
patch_test.go Add old-file-space patch arithmetic for landing on deletions 2026-08-08 12:58:59 +02:00
transform.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00