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
pull/137/head
Simon Let 6 years ago
parent 92c15c6a0b
commit 1910eb93d5
  1. 2
      cmd/cli/query.go

@ -2,6 +2,7 @@ package main
import ( import (
"log" "log"
"sort"
"strings" "strings"
) )
@ -54,6 +55,7 @@ func newQueryFromString(queryInput string, host string, pwd string, gitOriginRem
log.Println("QUERY filtered terms =" + logStr) log.Println("QUERY filtered terms =" + logStr)
log.Println("QUERY pwd =" + pwd) log.Println("QUERY pwd =" + pwd)
} }
sort.SliceStable(terms, func(i, j int) bool { return len(terms[i]) < len(terms[j]) })
return query{ return query{
terms: terms, terms: terms,
host: host, host: host,

Loading…
Cancel
Save