-
Notifications
You must be signed in to change notification settings - Fork 22
Added support for sorting folders above files. #33
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
Conversation
|
|
|
I just now realized you meant this to show directires above files. My bad, I need some coffee... |
|
I think I agree that it's a bit annoying to read for minor speed improvements. I decided to I'll most likely merge this & turn it all into 1 loop with some goto's as continue statements, unless you feel like doing it. Just make sure to change to using |
…ng files, however: in function try_open_at_y.
|
What is the "problem opening files" you mentioned in the last commit? |
|
I get the following error when I try to open a file (tab key): Any ideas? |
| if #files > 0 then | ||
| -- Append any files to results, now that all folders have been added | ||
| -- files will be > 0 only if folders_first and there are files | ||
| for i = 0, #files do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicies start on 1 in Lua (unless you specifically create a zero index). This is (probably) what's causing the issues with try_open_at_y, as when it goes to access it, it gets a nil value.
Change that 0 to a 1 & I should be able to merge this.
|
I would test this myself, but for some reason the nightly bin won't launch for me. If someone else is willing (@tommyshem @NicolaiSoeborg ?), pull his remote, fix the attempt to access a nil value, and see if this PR works 👍 Otherwise you'll be waiting on me to get Micro working. |
|
Tested on Mac as is and it works. Not sure what the fix access nil value is? To get the latest micro I just pulled it from GitHub and built it with I don't use micro editor much now as using vscode with plugins but willing to help test with more info. |
|
@tommyshem This #33 (review) The fix is just changing the 0 to a 1 (and then testing the opening of a few files). And yeah, I haven't personally been using Micro for a while now either. |
|
Tested on Mac and nightly version ./micro --version I have not changed the 0 to 1 (original pull request) and I can not get it to crash with any errors it opens the right files. Tried in different directories and different files and can not get it to crash on Mac. Is it related to #28 fault with micro 1.4.0 |
|
So I figured out how to get Micro working, and debugged a little bit. It turns out Lua is preventing an error here, which makes me curious why @cbrown1 even got errors. This code does assign a |
Very minor change to not start the loops index at 0, since Lua uses 1-based index. The rest is formatting changes from luafmt. Resolves #33
Very minor change to not start the loops index at 0, since Lua uses 1-based index. The rest is formatting changes from luafmt. Resolves #33
The only issue I am aware of is when building a full path to test whether a child is a folder. I don't really use lua much, and didn't find a function analogous to Python's os.path.join. So as you can see, I hardcoded something but I don't know how portable it is (I am on linux).
I tried to respect your effort to minimize if's inside loops, and the added functionality adds a layer of complexity when reading the code as a result. See what you think.