-
Notifications
You must be signed in to change notification settings - Fork 69
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
Keybind next-file jumps to wrong file #606
Comments
When you browse files with open-file, is the sorting correct there? |
I've now looked into this a bit and it works perfectly fine for me, the files get sorted correctly and everything. @tomasklaen I haven't actually tested this, but I'm pretty sure that symbol order thing is completely useless right now. We always pass absolute paths to the sorting function, and the symbol order is only respected for the first character of that path. No one ever even noticed apparently, so should we remove that and just use the exact same sorting as autoload.lua? |
To remove instead of fix symbol sorting if none cares for it: sure And by autoload sorting, you mean this? function splitbynum(s)
local result = {}
for x, y in (s or ""):gmatch("(%d*)(%D*)") do
if x ~= "" then table.insert(result, tonumber(x)) end
if y ~= "" then table.insert(result, y) end
end
return result
end
function clean_key(k)
k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
return splitbynum(k)
end
-- compare two strings
function alnumcomp(x, y)
local xt, yt = clean_key(x), clean_key(y)
for i = 1, math.min(#xt, #yt) do
local xe, ye = xt[i], yt[i]
if type(xe) == "string" then ye = tostring(ye)
elseif type(ye) == "string" then xe = tostring(xe) end
if xe ~= ye then return xe < ye end
end
return #xt < #yt
end How is it better than what we have? It's doing some magicky things, so I can't tell. And wouldn't it be slower? It seems to create 2 tables for each comparison, while we create one table per item once. |
What I mean is this. It's already the same algorithm, with the same optimizations, the only difference is that uosc also has the symbol order. |
May I ask if the merge fixes the problem? If so, I will try it. |
No, and I honestly doubt there actually is any problem. You probably have shuffle turned on. |
Indeed but I think shuffle should only apply to the keybind "next" instead of next-file |
Shift+n script-binding uosc/next-file; script-message-to uosc flash-elements top_bar,timeline #! Navigation > Next File
The text was updated successfully, but these errors were encountered: