From 4fbb4cf28940aa913ddaef1e3db1e36e19d96062 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Sun, 18 Aug 2024 22:02:15 -0500 Subject: [PATCH] fix: index in search dedupe Signed-off-by: jolheiser --- internal/html/repo_search.templ | 2 +- internal/html/repo_search_templ.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/html/repo_search.templ b/internal/html/repo_search.templ index 0dccff2..0995b2d 100644 --- a/internal/html/repo_search.templ +++ b/internal/html/repo_search.templ @@ -17,7 +17,7 @@ func (s SearchContext) DedupeResults() [][]git.GrepResult { var idx int for _, result := range s.Results { if result.File == currentFile { - results[idx] = append(results[idx], result) + results[idx-1] = append(results[idx-1], result) continue } results = append(results, []git.GrepResult{result}) diff --git a/internal/html/repo_search_templ.go b/internal/html/repo_search_templ.go index 3e33b3e..d23a975 100644 --- a/internal/html/repo_search_templ.go +++ b/internal/html/repo_search_templ.go @@ -27,7 +27,7 @@ func (s SearchContext) DedupeResults() [][]git.GrepResult { var idx int for _, result := range s.Results { if result.File == currentFile { - results[idx] = append(results[idx], result) + results[idx-1] = append(results[idx-1], result) continue } results = append(results, []git.GrepResult{result})