Compare commits
1 Commits
master
...
case-insen
Author | SHA1 | Date | |
---|---|---|---|
|
cb55293bdb |
12
page.go
12
page.go
|
@ -123,8 +123,9 @@ func (p *Page) HighlightFoundText() {
|
|||
if p.SearchTerm == "" {
|
||||
return
|
||||
}
|
||||
lowS := strings.ToLower(p.SearchTerm)
|
||||
for i, ln := range p.WrappedContent {
|
||||
found := strings.Index(ln, p.SearchTerm)
|
||||
found := strings.Index(strings.ToLower(ln), lowS)
|
||||
if found < 0 {
|
||||
continue
|
||||
}
|
||||
|
@ -132,7 +133,8 @@ func (p *Page) HighlightFoundText() {
|
|||
if bombadillo.Options["theme"] == "inverse" {
|
||||
format = "\033[27m%s\033[7m"
|
||||
}
|
||||
ln = strings.Replace(ln, p.SearchTerm, fmt.Sprintf(format, p.SearchTerm), -1)
|
||||
foundS := ln[found:found+len(lowS)]
|
||||
ln = strings.Replace(ln, foundS, fmt.Sprintf(format, foundS), -1)
|
||||
p.WrappedContent[i] = ln
|
||||
}
|
||||
}
|
||||
|
@ -148,12 +150,14 @@ func (p *Page) FindText() {
|
|||
if bombadillo.Options["theme"] == "inverse" {
|
||||
format = "\033[27m%s\033[7m"
|
||||
}
|
||||
lowS := strings.ToLower(s)
|
||||
for i, ln := range p.WrappedContent {
|
||||
found := strings.Index(ln, s)
|
||||
found := strings.Index(strings.ToLower(ln), lowS)
|
||||
if found < 0 {
|
||||
continue
|
||||
}
|
||||
ln = strings.Replace(ln, s, fmt.Sprintf(format, s), -1)
|
||||
foundS := ln[found:found+len(lowS)]
|
||||
ln = strings.Replace(ln, foundS, fmt.Sprintf(format, foundS), -1)
|
||||
p.WrappedContent[i] = ln
|
||||
p.FoundLinkLines = append(p.FoundLinkLines, i)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user