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

Something like :panel_right_no_open for staging area -- :focus_staging_no_open ? #926

Closed
AndydeCleyre opened this issue Aug 5, 2024 · 8 comments · Fixed by #934 or #939
Closed
Labels
enhancement New feature or request

Comments

@AndydeCleyre
Copy link

Maybe I'm thinking about this wrong, but basically, sometimes I add a bunch of files to the staging area, then want to rm them. But the way it works makes it easy to accidentally rm some selected file in the left pane, whereas I want rm to apply to the staging area if and when there is one.

So I would want to define my own rm verb that does something like :focus_staging_no_open (has no effect if there is no staging area, even if there is a right-hand pane), then rm.

@AndydeCleyre AndydeCleyre added the enhancement New feature or request label Aug 5, 2024
@Canop
Copy link
Owner

Canop commented Aug 15, 2024

Filtering verbs by the kind of panel might find more use.

Something like

    {
        invocation: my_rm
        internal: trash
        panels: ["stage"]
    }

?

(edit: fixed the example)

@AndydeCleyre
Copy link
Author

Oh, thanks! I'm looking at that filter description (docs say it should be stage) but am unclear on the behavior.

If I assign that to the invocation rm, and invoke it while the non-staging panel has focus, will that run and apply to the staging panel? And if no staging panel is open, it will continue to do the default rm thing?

@Canop
Copy link
Owner

Canop commented Aug 16, 2024

That's the idea.
But it looks like this filter is broken (implementation is missing for some verb triggering types). I'll have a look.

@Canop
Copy link
Owner

Canop commented Aug 16, 2024

With #934, if you define a rm with a panels: ["stage"] filter, it will be applied when called in the staging area, while the other one will be applied in other panel types.

@AndydeCleyre
Copy link
Author

I think there may have been a misreading of the behavior I'm after, especially as written in my last comment. I just tested with 1.43.0 and the my_rm verb from here, with the following setup (Zsh):

$ mkdir rmtest
$ touch rmtest/do_{,not_}trash_{1,2,3}
$ br rmtest

I then mark/select the three do_trash_* files, and move focus to one of the do_not_trash_* files.

If I try my_rm here it says "verb not found" (because of the filter). I was looking for something that would act on the non-focused staging panel.

But also, when I change focus to the staging panel and try the my_rm verb, nothing happens when I hit enter (it still says "Hit enter to my_rm: :trash").

@Canop Canop reopened this Sep 2, 2024
@Canop
Copy link
Owner

Canop commented Sep 2, 2024

I think there may have been a misreading of the behavior I'm after

This is exact. I reopened.

@Canop
Copy link
Owner

Canop commented Sep 2, 2024

@AndydeCleyre Is #926 better ?

I named it :focus_staging_area_no_open to be more consistent with the existing :open_staging_area.

@AndydeCleyre
Copy link
Author

Thank you, yes when I explicitly build with the trash feature enabled that works! The only thing is that the hint text before I hit enter reflects the currently focused file, which is misleading, because the value of file changes during the action.

Hit enter to my_rm: :focus_staging_area_no_open;:trash /home/andy/.config/broot/rmtest/do_not_trash_1

After hitting enter, do_not_trash_1 is not deleted, which is good.

@Canop Canop closed this as completed in #939 Sep 5, 2024
@Canop Canop closed this as completed in fd82ec9 Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants