Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch fuzzysearch to upstream #52

Merged
merged 1 commit into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

[[constraint]]
branch = "master"
name = "github.com/evidlo/fuzzysearch"
name = "github.com/renstrom/fuzzysearch"

[prune]
go-tests = true
Expand Down
12 changes: 6 additions & 6 deletions ui/fuzzy-search-modal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.