-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: use input dir if needed when changing cwd #487
Conversation
178ba98
to
8bbfecd
Compare
8bbfecd
to
089d0e4
Compare
I have hunch why that might be - when yazi is started, yazi.nvim also starts ya (the command line utility that listens for yazi's events). It is currently not possible to start ya if yazi is not running (sxyazi/yazi#1314), so initial events cannot be read and will be lost. I think this is a really good idea. I will check that the tests are still valid and then merge it 👍🏻 |
Hmm, I made some changes and I'm no longer sure if it fits your use case. Could you give it a try before merging? I noticed the general case works, but it looks like if I do the following operations, it's a bit weird:
In this case, it seems to change back to the original directory. I think it should maybe do nothing. |
Yes, I tested it, and you are right. When opening Yazi with the current file, it works fine because I will try to test if it works but I think it would be fine to check when calling the function whether |
Could you take a look at the changes? It seems like it cannot pass two of the tests |
Just tried it, and it seems the previous case still fails. Does it work for you? |
It works perfectly for me. Which command did you use to start Yazi? Do you start it in |
I found another bug with |
Yes, Here's how I'm able to reproduce it:
|
I cannot reproduce the issue on my side. After pressing the keybinding in step 6, nothing happens. The only thing I notice when trying to debug is that if the last hover is a directory when trying to resume, yazi would start inside the directory hovered. I guess the expected behavior would be to start in the last opened directory with the hover on previously selected directory. |
Also, I tried to roll back to the commit before this feature was implemented. The problem still exists. I think it would be valuable to take at the implementation of |
Hmm, I see. I think the bug I described is not serious and realistically almost nobody will ever hit it.
This sounds like it could be due to sxyazi/yazi#1314 like I described in a previous message. Starting yazi and hovering a specified directory is being discussed can be tracked here sxyazi/yazi#1610 I added some changes to make sure the feature is tested with its current behaviour. Can you make sure it still works for you? I can merge it in after that. |
I added code to handle the case when |
Thanks! |
context.ya_process.cwd
isnil
, making the function ineffective. Therefore, I implement it so it uses input_path in this case.last_directory
equals cwd when the function is called, in which cwd does not need to be changed.