Remove RankFind
Doesn't work correctly with next and previous actions
This commit is contained in:
parent
4234a63d7d
commit
d66673d4b6
@ -1,8 +1,6 @@
|
|||||||
package components
|
package components
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
|
||||||
|
|
||||||
"github.com/erroneousboat/termui"
|
"github.com/erroneousboat/termui"
|
||||||
"github.com/renstrom/fuzzysearch/fuzzy"
|
"github.com/renstrom/fuzzysearch/fuzzy"
|
||||||
)
|
)
|
||||||
@ -202,12 +200,11 @@ func (c *Channels) ScrollDown() {
|
|||||||
func (c *Channels) Search(term string) {
|
func (c *Channels) Search(term string) {
|
||||||
c.SearchMatches = make([]int, 0)
|
c.SearchMatches = make([]int, 0)
|
||||||
|
|
||||||
matches := fuzzy.RankFind(term, c.List.Items)
|
matches := fuzzy.Find(term, c.List.Items)
|
||||||
sort.Sort(matches)
|
|
||||||
|
|
||||||
for _, m := range matches {
|
for _, m := range matches {
|
||||||
for i, item := range c.List.Items {
|
for i, item := range c.List.Items {
|
||||||
if m.Target == item {
|
if m == item {
|
||||||
c.SearchMatches = append(c.SearchMatches, i)
|
c.SearchMatches = append(c.SearchMatches, i)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user