switch fuzzysearch to upstream

This commit is contained in:
evan 2018-05-23 10:20:53 -05:00
parent 55e36ad06a
commit 9f425f9909
6 changed files with 15 additions and 15 deletions

14
Gopkg.lock generated
View File

@ -13,12 +13,6 @@
revision = "bbcee2f5c9d5e94ca42c8b50ec847fec64a6c134"
version = "v1.4.2"
[[projects]]
branch = "master"
name = "github.com/evidlo/fuzzysearch"
packages = ["fuzzy"]
revision = "f6153b556daf86b90da85818544c8b498640759c"
[[projects]]
branch = "master"
name = "github.com/gdamore/encoding"
@ -49,6 +43,12 @@
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/renstrom/fuzzysearch"
packages = ["fuzzy"]
revision = "500e0fce37a81072d9bf4ec1bf5d32f52c807282"
[[projects]]
branch = "master"
name = "github.com/shurcooL/sanitized_anchor_name"
@ -144,6 +144,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a206fe41b10601a6e9cf402fc120084d48f589287882674baee54855ad513da1"
inputs-digest = "2a15ea883a6ee15a2274160ad22f40976519ca0a2d15c4412c04fb02e9a31223"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -75,7 +75,7 @@
[[constraint]]
branch = "master"
name = "github.com/evidlo/fuzzysearch"
name = "github.com/renstrom/fuzzysearch"
[prune]
go-tests = true

View File

@ -21,7 +21,7 @@ import (
"sort"
"strconv"
"github.com/evidlo/fuzzysearch/fuzzy"
"github.com/renstrom/fuzzysearch/fuzzy"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/ui/widget"
@ -93,10 +93,10 @@ func (fs *FuzzySearchModal) changeHandler(str string) {
sort.Sort(fs.matches)
fs.results.Clear()
for _, match := range fs.matches {
fmt.Fprintf(fs.results, `["%d"]%s[""]%s`, match.Index, match.Target, "\n")
fmt.Fprintf(fs.results, `["%d"]%s[""]%s`, match.OriginalIndex, match.Target, "\n")
}
fs.parent.Render()
fs.results.Highlight(strconv.Itoa(fs.matches[0].Index))
fs.results.Highlight(strconv.Itoa(fs.matches[0].OriginalIndex))
fs.results.ScrollToBeginning()
} else {
fs.results.Clear()
@ -116,15 +116,15 @@ func (fs *FuzzySearchModal) keyHandler(event *tcell.EventKey) *tcell.EventKey {
// Cycle highlighted area to next match
if len(highlights) > 0 {
fs.selected = (fs.selected + 1) % len(fs.matches)
fs.results.Highlight(strconv.Itoa(fs.matches[fs.selected].Index))
fs.results.Highlight(strconv.Itoa(fs.matches[fs.selected].OriginalIndex))
fs.results.ScrollToHighlight()
}
return nil
case tcell.KeyEnter:
// Switch room to currently selected room
if len(highlights) > 0 {
debug.Print("Fuzzy Selected Room:", fs.roomList[fs.matches[fs.selected].Index].GetTitle())
fs.mainView.SwitchRoom(fs.roomList[fs.matches[fs.selected].Index].Tags()[0].Tag, fs.roomList[fs.matches[fs.selected].Index])
debug.Print("Fuzzy Selected Room:", fs.roomList[fs.matches[fs.selected].OriginalIndex].GetTitle())
fs.mainView.SwitchRoom(fs.roomList[fs.matches[fs.selected].OriginalIndex].Tags()[0].Tag, fs.roomList[fs.matches[fs.selected].OriginalIndex])
}
fs.parent.views.RemovePage("fuzzy-search-modal")
fs.parent.app.SetFocus(fs.parent.views)

View File

@ -158,7 +158,7 @@ type Rank struct {
Distance int
// Location of Target in original list
Index int
OriginalIndex int
}
type Ranks []Rank