From 575476857a172020167a22e01dd66a9339a69b45 Mon Sep 17 00:00:00 2001 From: Robin Schubert Date: Thu, 28 Mar 2024 14:44:40 +0100 Subject: [PATCH] remove redundant bool --- display/display.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/display/display.go b/display/display.go index 801f9b2..99dfa54 100644 --- a/display/display.go +++ b/display/display.go @@ -184,7 +184,6 @@ func Init(version, commit, builtBy string) { text := make([]byte, 0) matches = 0 lastMatch := 0 - var isMatch bool // loops through all occurrences and check if they // discard if they lie within tags. @@ -192,21 +191,17 @@ func Init(version, commit, builtBy string) { // with the actual search strings replaced by tagged regions // to highlight. for i, match := range searchIdx { - isMatch = true for _, tag := range tagsIdx { if match[0] >= tag[0] && match[1] <= tag[1] { - isMatch = false break } } - if isMatch { - matches++ - text = append(text, originalText[lastMatch:match[0]]...) - replacement := []byte(fmt.Sprint(`["search-`, i, `"]`, searchString, `[""]`)) - text = append(text, replacement...) - lastMatch = match[0] + len(searchString) - } + matches++ + text = append(text, originalText[lastMatch:match[0]]...) + replacement := []byte(fmt.Sprint(`["search-`, i, `"]`, searchString, `[""]`)) + text = append(text, replacement...) + lastMatch = match[0] + len(searchString) } text = append(text, originalText[lastMatch:]...)