From 1b3bb4f6f8ec0ff25921923df2947be7bdc5a4ce Mon Sep 17 00:00:00 2001 From: Simon Let Date: Sat, 25 Feb 2023 15:48:19 +0100 Subject: [PATCH] Trim right whitespace in deduplication key --- internal/searchapp/item.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/searchapp/item.go b/internal/searchapp/item.go index cf4c1fb..9660348 100644 --- a/internal/searchapp/item.go +++ b/internal/searchapp/item.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" "time" + "unicode" "github.com/curusarn/resh/internal/recordint" "golang.org/x/exp/utf8string" @@ -382,14 +383,8 @@ func NewItemFromRecordForQuery(record recordint.SearchApp, query Query, debug bo cmdLineWithColor := strings.ReplaceAll(cmd, "\n", "\\n ") // KEY for deduplication + key := strings.TrimRightFunc(record.CmdLine, unicode.IsSpace) - key := record.CmdLine - // NOTE: since we import standard history we need a compatible key without metadata - /* - unlikelySeparator := "|||||" - key := record.CmdLine + unlikelySeparator + record.Pwd + unlikelySeparator + - record.GitOriginRemote + unlikelySeparator + record.Host - */ if record.IsRaw { return Item{ isRaw: true,