fix: index in search dedupe

Signed-off-by: jolheiser <git@jolheiser.com>
main
jolheiser 2024-08-18 22:02:15 -05:00
parent 0ae76c9d74
commit 4fbb4cf289
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ func (s SearchContext) DedupeResults() [][]git.GrepResult {
var idx int var idx int
for _, result := range s.Results { for _, result := range s.Results {
if result.File == currentFile { if result.File == currentFile {
results[idx] = append(results[idx], result) results[idx-1] = append(results[idx-1], result)
continue continue
} }
results = append(results, []git.GrepResult{result}) results = append(results, []git.GrepResult{result})

View File

@ -27,7 +27,7 @@ func (s SearchContext) DedupeResults() [][]git.GrepResult {
var idx int var idx int
for _, result := range s.Results { for _, result := range s.Results {
if result.File == currentFile { if result.File == currentFile {
results[idx] = append(results[idx], result) results[idx-1] = append(results[idx-1], result)
continue continue
} }
results = append(results, []git.GrepResult{result}) results = append(results, []git.GrepResult{result})