broot icon indicating copy to clipboard operation
broot copied to clipboard

Possible UX Feature for Multiple-Selection to Staging

Open johnstanforth opened this issue 3 years ago • 7 comments

First off... Wow! This is just a FANTASTIC tool... seriously, wow. I've been a Linux/Unix user for almost 30 years, and I'm blown-away by how great broot is. Fundamentally changes how I interact with filesystems, which is kind of shocking after all this time. I've written high-speed file transfer systems in the past and had ideas for similar Linux/Unix command-line tools recently, but broot just completely exceeds those ideas, like giving me features I didn't even know I wanted. :smile:

One feature request, if possible: I saw previous discussions about multiple-file selection in modal vs non-modal modes, and I think it would greatly improve the UX flow to add one additional way to pre-select multiple files, even just for one specific use-case, to then add to Staging:

  • In non-modal "normal" input mode, have a [Shift-Arrow-Down] and [Shift-Arrow-Up] selection binding similar to Midnight Commander (and I assume, Norton Commander, on which the mc keystrokes are modeled?)
  • The current broot Staging system is already the correct way to handle multiple files, and it works brilliantly well, so the only thing this new feature would do would allow faster/easier addition of files to Staging. [Shift-Arrow-Down], [-Down], [-Down]... three files are highlighted... then [Ctrl-G] as usual/current-UX to add them to Staging.
  • When already added to Staging (and therefore, no longer shift-select-highlighted in the tree), a similar [Shift-Arrow-Down], [-Down], [-Down] will let me shift-select three already-staged files (which each have the Staged indicator icon, same as current UX), then [Ctrl-G] to UN-Stage these three files.
  • For any single line/file, [Ctrl-G] will add to Staging or remove, exactly same as the current-UX behavior.
  • Most importantly, this new feature should support multiple-selection in the search-narrowed list. So if I type "jpg" to show only those files in the tree, then I can quickly [Shift-Arrow-Down] on some of the visible items to select and add them to Staging. (I think someone else asked for glob support to add to Staging, and this doesn't completely replace that idea, but for many of my use-cases selecting and moving files around, a quick extension-search and then shift-selecting down a dozen files, while also allowing to SKIP certain matched files that I DON'T want to move, would reduce my own need for glob support at least.)

And of course, I've only been using this a few days now, so if there's already a way to accomplish this some other way / some existing way, then sorry for the added noise here and just let me know what I'm missing. :grin: Thanks again for creating such great software!

johnstanforth avatar Mar 30 '22 22:03 johnstanforth

First off... Wow! This is just a FANTASTIC tool... seriously, wow. I've been a Linux/Unix user for almost 30 years, and I'm blown-away by how great broot is. Fundamentally changes how I interact with filesystems, which is kind of shocking after all this time. I've written high-speed file transfer systems in the past and had ideas for similar Linux/Unix command-line tools recently, but broot just completely exceeds those ideas, like giving me features I didn't even know I wanted. 😄

Pretty much my same xp (with quite few years :p) This is a very good description of what using broot feel like.

Stargateur avatar Mar 31 '22 01:03 Stargateur

My preferred approach for making such actions is to define internals that I can then bind to keys. I think some of the actions you'd like can already be configured with the current internals (look for "stag" in the list). I have also in my TODO list a :stage_all internal which would allow staging all matching files. It looks like it would satisfy the other need.

*(feel free to correct me, as I don't always immediately grasp the whole wishes of a new user) *

Canop avatar Mar 31 '22 05:03 Canop

I solve the globbing issue satisfyingly with this: I can filter and add all files with or without directories, almost as quickly as a "toggle_all" feature. the capacity of renaming commands differing only on their targets proved very useful, it reminded me of Ada polyvalent renamings.

{
	key: ctrl-a
        cmd: ":tsfo;:next_match"
        leave_broot: false
        apply_to: any
    }
              
    {
    	invocation: tsfo
    	internal: ":toggle_stage"
        leave_broot: false
    	apply_to: file
    }
	{
        key: ctrl-z
        cmd: ":toggle_stage;:next_match"        
        leave_broot: false
        apply_to: any
    }

evanescente-ondine avatar Mar 31 '22 13:03 evanescente-ondine

My preferred approach for making such actions is to define internals that I can then bind to keys. I think some of the actions you'd like can already be configured with the current internals (look for "stag" in the list). I have also in my TODO list a :stage_all internal which would allow staging all matching files. It looks like it would satisfy the other need.

Not exactly the same, but :stage_all and the suggestions from @evanescente-ondine can give me an approximation of what I was describing. And that's fine... I'd rather not add more work to your queue if the approximation is close enough. :smile:

Just for clarification, though, what I was describing was conceptually different, like having a set of "selected in the tree" items, where the code would likely add a .selected flag/trait to each tree node, something like that. The current UX is that whichever line the cursor is focused on, that is the (single, only) selected item... My idea would have added multiple lines selected in the tree. Then :stage would add all the selected-in-tree items, either multiple lines/items (new UX) or just the one currently-focused item if no other tree-items are selected (same as current UX, de facto since you can't pre-select multiple lines/items).

[Edit: The per-node trait is meant to explain the concept, but for UI performance, it would be implemented very differently, like maybe an array of selected-tree-node ID's, especially since it also gets cleared on any new search.]

In practical terms, that means if you have a list of 10 files/dirs, you could quickly select {1, 2, 3, 7, 8, 9} in the tree, then [Ctrl-G] once to add them all to the Staging Area. Midnight Commander (and probably Norton) use this kind of tree-item selection method to then copy/move multiple selected files to the other panel, but of course, they also don't have the concept of the Staging Area, so perhaps my mistake is "mixing metaphors," creating a "middle-MIDDLE" "PRE-Staging selection" type intermediate area. But from a code view, thinking of it as a flag/trait on the tree-item node, it seemed feasible to simplify the UX, especially given the default [Ctrl-G] binding.

In any case, seems like I can get a quick partial approximation of what I wanted by just mapping shift-arrow-down to ":toggle_stage;:next_match" as noted... Thanks, @evanescente-ondine for that!

johnstanforth avatar Mar 31 '22 23:03 johnstanforth

+1 to this, just now going back to mc because this functionality is lacking :stage_all could work but not if the files don't have any commonality and just happen to be next to each to each other or there is a need to sort through a group. eg. if there is a list that has five files i want, then one i don't, then three i do, then a gap, the more i want, more gaps, then so on, the number of key presses is vastly more than the mc approach. 😌

would love this functionality to be added - otherwise thankyou and i love broot!! ❤️

eddiehazel avatar Mar 17 '24 15:03 eddiehazel

Just an update (not answering any comment in particular): there are now 2 commands to stage all files matching the current filter (even the non visible ones): image

Canop avatar Mar 17 '24 15:03 Canop

a happy ending to my story:

Screenshot 2024-03-19 at 08 55 26

still not quite as slick as a midnight commander but almost there ❤️

(it turned out the clutching the shift to get + was what was really taxing the ux for me)

eddiehazel avatar Mar 19 '24 09:03 eddiehazel