-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update directory-movement.lua #104
Conversation
When accessing an address like "ftp://localhost", navigating upwards would jump to "ftp://", resulting in an error. The purpose of this commit is to clear the value of g.state.directory when it equals the protocol prefix.
When accessing an address like "ftp://localhost", navigating forwards from there would incorrectly jump to just "ftp://", resulting in an error. The purpose of this commit is to clear the value of g.state.directory when it equals the protocol prefix, to prevent this erroneous behavior.
Can you explain what the 2nd commit you made does? Because it's not what you're describing above and in the commit messages. |
The purpose of this pull request is that, in the process of going up one level, we want the configured address in the Originally, if the configuration was Now, with the added code, if the configuration is In the first commit, if the The second commit can correctly handle directories like |
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.
I'm fine with this sort of check, but you can't use the cache to do it, see my code comment. Also before I can accept this PR you need to squash all these commits into one.
if #cache > 0 and cache[#cache]["directory"] == "" then | ||
g.state.directory = "" | ||
end |
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.
This doesn't strictly fix the issue. This condition assumes that the cache will always reliably show the parent directory, but this is not the case; there are various ways that the cache can be cleared. For example jumping to the directory for the current file will clear the cache, as will using the Ctrl+r
rescan keybind. Your previous approach was better, though if you're going to detect if the path contains a protocol scheme you should use the existing API.get_protocol
function.
Also if you choose to use the protocol detection method I'd like you to add a new option that disables the behaviour.
Can the modification be done in the way mentioned above? My testing seems to have satisfied the requirements. After all, I don’t know much about this project, I’m just tentatively trying to meet the requirements. It would be great if you have a better solution. |
e.g. moving up from `ftp://localhost/` will move straight to the root instead of `ftp://` First brought up in (#104)
e.g. moving up from `ftp://localhost/` will move straight to the root instead of `ftp://` First brought up in (#104)
I've made an alternate proposal in #106 that shows how I would do it. |
e.g. moving up from `ftp://localhost/` will move straight to the root instead of `ftp://` First brought up in (#104)
I tried using these codes, and directory access returned normally. There is just one problem. Directories such as |
Yes that is deliberate, the root has always worked like that. Avoiding that issue is beyond the scope of a PR like this, it would be much more complicated. |
I see... |
When accessing an address like "ftp://localhost", navigating forwards from there would incorrectly jump to just "ftp://", resulting in an error. The purpose of this commit is to clear the value of g.state.directory when it equals the protocol prefix, to prevent this erroneous behavior.
