Commit fb4d1e1
committed
Fix undo hunk
Fixes mhinz#345
When `new_count` is `0` it's a special case meaning that lines should be inserted after `new_line`, not instead of it.
When you remove `line 2` from file:
```
line 1
line 2
line 3
line 4
```
the diff looks line this:
```diff
index 9c2a709..cbf7f40 100644
--- a/test.txt
+++ b/test.txt
@@ -2 +1,0 @@ line 1
-line 2
```
It means `line 2` in `undo` should be inserted below line 1 (`new_line`) and before it was inserted after line 0 (`new_line - 1`).1 parent 98c693f commit fb4d1e1
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| |||
0 commit comments