Closed cpkio closed 1 year ago
Hey! Thanks for raising the request :)
That's a good catch, I just haven't played around with it yet. I will try looking into it this week and report back.
I have just rolled out a fix. Can you let me know if it works for you? @cpkio
Thanks :)
@shikaan Only when a Windows binary will be available, I'm not building from sources.
@shikaan Unicode seems to be working, thanks. Managed to crash immediately on key input)
panic: runtime error: slice bounds out of range [150:148]
goroutine 11 [running]:
golang.org/x/text/transform.String({0xceda68, 0xf5af90}, {0xc001e56000, 0x94})
/go/pkg/mod/golang.org/x/text@v0.7.0/transform/transform.go:650 +0xbe5
github.com/lithammer/fuzzysearch/fuzzy.stringTransform({0xc001e56000, 0x94}, {0xceda68?, 0xf5af90?})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:243 +0x5a
github.com/lithammer/fuzzysearch/fuzzy.match({0xc0021b1277?, 0x0?}, {0xc001e56000, 0x94}, {0xceda68, 0xf5af90})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:57 +0x71
github.com/lithammer/fuzzysearch/fuzzy.find(...)
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:107
github.com/lithammer/fuzzysearch/fuzzy.FindFold({0xc0021b1277, 0x1}, {0xc001e7b000?, 0x364, 0xc0000e5d58?})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:90 +0xc9
github.com/shikaan/keydex/tui/components.NewAutoComplete.func1({0xc001faa000?, 0xc0021b1277?})
/source/tui/components/autocomplete.go:51 +0x4d
github.com/shikaan/keydex/tui/components.(*Input).handleContentUpdate(0xc001faa000, {0xcecc40, 0xc002082700}, 0xc0000e5dd0)
/source/tui/components/input.go:198 +0xce
github.com/shikaan/keydex/tui/components.(*Input).HandleEvent(0xc0021b1276?, {0xcecc40?, 0xc002082700?})
/source/tui/components/input.go:148 +0x11e
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xc8b7d2?, {0xcecc40?, 0xc002082700})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xc0000e5ee0?, {0xcecc40?, 0xc002082700})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xc002082700?, {0xcecc40?, 0xc002082700})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/shikaan/keydex/tui.(*Layout).HandleEvent(0xc000091100?, {0xcecc40?, 0xc002082700?})
/source/tui/layout.go:52 +0x1e9
github.com/gdamore/tcell/v2/views.(*Application).run(0xf079b0)
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/app.go:165 +0x2a9
created by github.com/gdamore/tcell/v2/views.(*Application).Start
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/app.go:175 +0x6a ```
:facepalm: I did not add support for it in the fuzzy search. I'm reopening it and will take a look tonight. Thanks for the report
Hey @cpkio (: Thanks for your patience!
Can you try this build and see if it works for you?
@shikaan This build fails with panic on any input in fuzzy search:
panic: runtime error: slice bounds out of range [150:148]
goroutine 8 [running]:
golang.org/x/text/transform.String({0xbeec88, 0xe5bf50}, {0xc001ea2000, 0x94})
/go/pkg/mod/golang.org/x/text@v0.7.0/transform/transform.go:650 +0xbe5
github.com/lithammer/fuzzysearch/fuzzy.stringTransform({0xc001ea2000, 0x94}, {0xbeec88?, 0xe5bf50?})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:243 +0x5a
github.com/lithammer/fuzzysearch/fuzzy.match({0xc001ddbd58?, 0xc001dc6480?}, {0xc001ea2000, 0x94}, {0xbeec88, 0xe5bf50})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:57 +0x71
github.com/lithammer/fuzzysearch/fuzzy.find(...)
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:107
github.com/lithammer/fuzzysearch/fuzzy.FindFold({0xc001ddbd58, 0x1}, {0xc001ec7000?, 0x365, 0x1?})
/go/pkg/mod/github.com/lithammer/fuzzysearch@v1.1.5/fuzzy/fuzzy.go:90 +0xc9
github.com/shikaan/keydex/tui/components.NewAutoComplete.func1({0xc001ef6000?, 0xc001ddbd58?})
/source/tui/components/autocomplete.go:50 +0x4d
github.com/shikaan/keydex/tui/components.(*Input).handleContentUpdate(0xc001ef6000, {0xbede60, 0xc001e90bc0}, 0xc000505860?)
/source/tui/components/input.go:243 +0xba
github.com/shikaan/keydex/tui/components.(*Input).HandleEvent(0xc001ef6000, {0xbede60?, 0xc001e90bc0?})
/source/tui/components/input.go:203 +0x19f
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xb8c82d?, {0xbede60?, 0xc001e90bc0})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xc000473ee0?, {0xbede60?, 0xc001e90bc0})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/gdamore/tcell/v2/views.(*BoxLayout).HandleEvent(0xc001e90bc0?, {0xbede60?, 0xc001e90bc0})
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/boxlayout.go:240 +0xbe
github.com/shikaan/keydex/tui.(*Layout).HandleEvent(0xc00048b100?, {0xbede60?, 0xc001e90bc0?})
/source/tui/layout.go:52 +0x1e9
github.com/gdamore/tcell/v2/views.(*Application).run(0xe08970)
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/app.go:165 +0x2a9
created by github.com/gdamore/tcell/v2/views.(*Application).Start
/go/pkg/mod/github.com/gdamore/tcell/v2@v2.5.4/views/app.go:175 +0x6a
🤔 Can you provide a string that leads to this error? I am unable to reproduce. Not sure how relevant, but maybe also your OS
@shikaan I do most of my daily work in terminal: Far, neovim, gitui, termscp, fd, fzf, and many others. None of console programs I use crashes like this, so OS is not a problem.
I've recorded a video for you: https://workupload.com/file/px52pJYtLYJ I just open entries browser and press any latin key there.
Thanks once again for you help here :) I deeply appreciate you taking the time for this shot :bow:
I have tried reproducing the issue (same script, different scripts, emoji...) on linux-amd64 and darwin-arm64 with no luck: everything seems to be going smooth. I'll try virtualise a windows environment and see if I get to reproduce it.
None of console programs I use crashes like this, so OS is not a problem.
Yeah, I was not implying the OS is a problem, but rather one of the libraries (specifically the one that does fuzzy search) does not play well with a specific OS. Any information on the environment you are running would be extremely helpful: I'm kinda fishing in the dark, so anything could be relevant.
Specifically, it would help knowing:
Thanks once again for the help!
Good news: I have managed to reproduce the issue on a virtualised windows! I'll try to get a fix out tonight, as I'll have a bit of free time.
Thanks once again for your patience :raised_hands:
A new version is out (: Do you mind giving another shot? This solved it in my reproduction
@shikaan This seems to be working, congrats!
I think fuzzy search needs some tweaking in the future so it would push more relevant searched to top.
Amazing! Thanks yet another time for the help in finding the problem :)
If you have preferences on the way the fuzzy search works, feel free to open another issue
For now fuzzy finder shows non-unicode results. Is unicode support in plans?