Skip to content
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(subtree): "toggle or open" should open file, not view it #281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brownts
Copy link

@brownts brownts commented Oct 20, 2024

Currently, dirvish-subtree-toggle-or-open utilizes dirvish-subtree-toggle to first attempt to toggle a directory line, then if that fails it assumes the current line represents a file and will attempt to open the file. Unfortunately,
dirvish-subtree-toggle has an error handler, so if the directory toggle does fail it will view the file and not propagate the error. Since an error handler prevents the propagation of a directory toggle failure up to dirvish-subtree-toggle-or-open, the result is that when the current line represents a file, it will always be viewed instead of opened.

Instead of depending on error propagation when the line is not a directory, this change instead checks to see if the line represents a directory first. When it is a directory, dirvish-subtree-toggle is called to handle the directory, otherwise the file is opened.

Currently, `dirvish-subtree-toggle-or-open` utilizes
`dirvish-subtree-toggle` to first attempt to toggle a directory line,
then if that fails it assumes the current line represents a file and
will attempt to open the file.  Unfortunately,
`dirvish-subtree-toggle` has an error handler, so if the directory
toggle does fail it will view the file and not propagate the error.
Since an error handler prevents the propagation of a directory toggle
failure up to `dirvish-subtree-toggle-or-open`, the result is that
when the current line represents a file, it will always be viewed
instead of opened.

Instead of depending on error propagation when the line is not a
directory, this change instead checks to see if the line represents a
directory first.  When it is a directory, `dirvish-subtree-toggle` is
called to handle the directory, otherwise the file is opened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant