From ab9c8ce2df04cc333c65468e4f53da38c0cee9e2 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Wed, 6 Apr 2022 19:48:30 +0200 Subject: [PATCH] Fixed unstage hunk not restoring lines properly --- src/main/kotlin/app/git/StatusManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/app/git/StatusManager.kt b/src/main/kotlin/app/git/StatusManager.kt index 6f1cf3a..f6317db 100644 --- a/src/main/kotlin/app/git/StatusManager.kt +++ b/src/main/kotlin/app/git/StatusManager.kt @@ -126,7 +126,7 @@ class StatusManager @Inject constructor( // Restore previously removed lines to the index for (line in removedLines) { // Check how many lines before this one have been deleted - val previouslyRemovedLines = addedLines.count { it.newLineNumber <= line.newLineNumber } - 1 + val previouslyRemovedLines = addedLines.count { it.newLineNumber < line.newLineNumber } textLines.add(line.newLineNumber + linesAdded - previouslyRemovedLines, line.text.withoutLineEnding) linesAdded++ }