From 1910eb93d53dcba4cc6d25bebf19e63e5dd36e9f Mon Sep 17 00:00:00 2001 From: Simon Let Date: Sun, 10 May 2020 15:18:33 +0200 Subject: [PATCH] hotfix highlighting issues when you highlight incrementally you keep adding escape codes to the string these escape codes contain chracters that next round of highlighting can wrap in a new set of escape codes this breaks the escape codes and produces mess on the view hotfix: sort the terms so that the short ones are highlighted first --- cmd/cli/query.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/cli/query.go b/cmd/cli/query.go index df72873..7fd8d4f 100644 --- a/cmd/cli/query.go +++ b/cmd/cli/query.go @@ -2,6 +2,7 @@ package main import ( "log" + "sort" "strings" ) @@ -54,6 +55,7 @@ func newQueryFromString(queryInput string, host string, pwd string, gitOriginRem log.Println("QUERY filtered terms =" + logStr) log.Println("QUERY pwd =" + pwd) } + sort.SliceStable(terms, func(i, j int) bool { return len(terms[i]) < len(terms[j]) }) return query{ terms: terms, host: host,