Closed snokpok closed 1 month ago
Hello! Yes, this is a limitation in the current logic and worth fixing.
Context: fuzzy matching and prioritization logic for the widget is super naive. It's just an in-order subsequence match, prioritizing either the passed-in default (usually current branch), or the first entry if the default is filtered out.
I've been meaning to switch to https://github.com/sahilm/fuzzy or similar for this logic, but haven't gotten around to it. If you're up for it, a PR doing this will be welcome. Otherwise, I expect I'll get to it at some point in the future now that there's an issue for it.
Awesome, I'll check out that library and send in a PR
Hi! I have been daily driving git-spice for a while and noticed that when I do
gs branch checkout
or anything that opens the branch selector widget, and then I try to search for a branch name, the cursor does not focus on the most relevant branch matching my search term -- it focuses on the very top branch or the current branch in the selector widget instead, which is fine for the most part, but I expect for, say, the most relevant one to appear first (e.g matched by prefix)For instance, I have this stack tree, and I'm currently on branch
marketing
:If I search for "main", it would be like this (the [..] are the characters that get highlighted):
But my cursor is still on
marketing
, meanwhile themain
branch matched my search term completely; I would expect in that case themain
branch should be focused i.e:It also doesn't have to be an exact match to be focused; something like if I search for "mai", then I should expect
main
to be focused because "mai" is a prefix ofmain
, as opposed to the other two branchesmarketing
andmarketing-2
.Let me know if this is something we can implement; I'm open to work on this.