switch fuzzysearch to upstream
This commit is contained in:
parent
55e36ad06a
commit
9f425f9909
14
Gopkg.lock
generated
14
Gopkg.lock
generated
@ -13,12 +13,6 @@
|
|||||||
revision = "bbcee2f5c9d5e94ca42c8b50ec847fec64a6c134"
|
revision = "bbcee2f5c9d5e94ca42c8b50ec847fec64a6c134"
|
||||||
version = "v1.4.2"
|
version = "v1.4.2"
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/evidlo/fuzzysearch"
|
|
||||||
packages = ["fuzzy"]
|
|
||||||
revision = "f6153b556daf86b90da85818544c8b498640759c"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/gdamore/encoding"
|
name = "github.com/gdamore/encoding"
|
||||||
@ -49,6 +43,12 @@
|
|||||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||||
version = "v1.0.0"
|
version = "v1.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/renstrom/fuzzysearch"
|
||||||
|
packages = ["fuzzy"]
|
||||||
|
revision = "500e0fce37a81072d9bf4ec1bf5d32f52c807282"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/shurcooL/sanitized_anchor_name"
|
name = "github.com/shurcooL/sanitized_anchor_name"
|
||||||
@ -144,6 +144,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "a206fe41b10601a6e9cf402fc120084d48f589287882674baee54855ad513da1"
|
inputs-digest = "2a15ea883a6ee15a2274160ad22f40976519ca0a2d15c4412c04fb02e9a31223"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/evidlo/fuzzysearch"
|
name = "github.com/renstrom/fuzzysearch"
|
||||||
|
|
||||||
[prune]
|
[prune]
|
||||||
go-tests = true
|
go-tests = true
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/evidlo/fuzzysearch/fuzzy"
|
"github.com/renstrom/fuzzysearch/fuzzy"
|
||||||
"maunium.net/go/gomuks/debug"
|
"maunium.net/go/gomuks/debug"
|
||||||
"maunium.net/go/gomuks/matrix/rooms"
|
"maunium.net/go/gomuks/matrix/rooms"
|
||||||
"maunium.net/go/gomuks/ui/widget"
|
"maunium.net/go/gomuks/ui/widget"
|
||||||
@ -93,10 +93,10 @@ func (fs *FuzzySearchModal) changeHandler(str string) {
|
|||||||
sort.Sort(fs.matches)
|
sort.Sort(fs.matches)
|
||||||
fs.results.Clear()
|
fs.results.Clear()
|
||||||
for _, match := range fs.matches {
|
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.parent.Render()
|
||||||
fs.results.Highlight(strconv.Itoa(fs.matches[0].Index))
|
fs.results.Highlight(strconv.Itoa(fs.matches[0].OriginalIndex))
|
||||||
fs.results.ScrollToBeginning()
|
fs.results.ScrollToBeginning()
|
||||||
} else {
|
} else {
|
||||||
fs.results.Clear()
|
fs.results.Clear()
|
||||||
@ -116,15 +116,15 @@ func (fs *FuzzySearchModal) keyHandler(event *tcell.EventKey) *tcell.EventKey {
|
|||||||
// Cycle highlighted area to next match
|
// Cycle highlighted area to next match
|
||||||
if len(highlights) > 0 {
|
if len(highlights) > 0 {
|
||||||
fs.selected = (fs.selected + 1) % len(fs.matches)
|
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()
|
fs.results.ScrollToHighlight()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
case tcell.KeyEnter:
|
case tcell.KeyEnter:
|
||||||
// Switch room to currently selected room
|
// Switch room to currently selected room
|
||||||
if len(highlights) > 0 {
|
if len(highlights) > 0 {
|
||||||
debug.Print("Fuzzy Selected Room:", fs.roomList[fs.matches[fs.selected].Index].GetTitle())
|
debug.Print("Fuzzy Selected Room:", fs.roomList[fs.matches[fs.selected].OriginalIndex].GetTitle())
|
||||||
fs.mainView.SwitchRoom(fs.roomList[fs.matches[fs.selected].Index].Tags()[0].Tag, fs.roomList[fs.matches[fs.selected].Index])
|
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.views.RemovePage("fuzzy-search-modal")
|
||||||
fs.parent.app.SetFocus(fs.parent.views)
|
fs.parent.app.SetFocus(fs.parent.views)
|
||||||
|
@ -158,7 +158,7 @@ type Rank struct {
|
|||||||
Distance int
|
Distance int
|
||||||
|
|
||||||
// Location of Target in original list
|
// Location of Target in original list
|
||||||
Index int
|
OriginalIndex int
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ranks []Rank
|
type Ranks []Rank
|
Loading…
Reference in New Issue
Block a user