jesseduffield.lazygit/pkg/commands/patch
Stefan Haller 8fbc70bf84 Fix staging only some lines of a block of consecutive changes
This fixes the problem; a consequence of this change is that given the following
scenario:

@@ -1,3 +1,3 @@
 1
-2
+2b
 3

staging only the line `+2b` will put it *before* the unchanged `2` line, rather
than after it as you might expect (the changed unit tests demonstrate this).
Since this should be a pretty uncommon scenario, I guess it is an ok compromise.

As you can see in the changed tests, while the behavior of what gets staged is
fixed now, it doesn't always correctly select the next line to stage. We'll
address this in the next commit.
2026-03-19 16:57:53 +01: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 Don't use hunk mode for added or deleted files 2025-07-27 12:10:25 +02:00
patch_builder.go refactor: use strings.Builder and strings.Repeat to simplify code 2025-12-03 18:34:21 +01:00
patch_line.go Export PatchLine.isChange 2025-07-04 10:14:35 +02:00
patch_test.go Fix staging only some lines of a block of consecutive changes 2026-03-19 16:57:53 +01:00
transform.go Fix staging only some lines of a block of consecutive changes 2026-03-19 16:57:53 +01:00