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

feat: add counter component to the header for displaying currently selected/yanked items #646

Merged
merged 12 commits into from
Feb 15, 2024

Conversation

Rolv-Apneseth
Copy link
Contributor

No description provided.

@sxyazi
Copy link
Owner

sxyazi commented Feb 9, 2024

Thank you for the PR!

I just want to add an API to get the number of selected files, but I realized an issue - currently, the selection state is specific to the directory, meaning it can only get the selection state of the current directory.

But it would make more sense to get all selected files for display. We will add support for selecting across directories in the future.

So I need to do some refactoring to modify it to a tab-specific global selection state. I'll continue reviewing this PR after the refactoring is done :)

@Rolv-Apneseth
Copy link
Contributor Author

Ah I didn't catch that actually. Best of luck then, we can come back to this later

@og900aero
Copy link

Would it be possible to write not only the number of selected/yanked items, but also the size of all selected items?

@Rolv-Apneseth
Copy link
Contributor Author

Would it be possible to write not only the number of selected/yanked items, but also the size of all selected items?

That may be better as a plugin or at least a separate feature, @sxyazi what do you think?

@sxyazi
Copy link
Owner

sxyazi commented Feb 14, 2024

Yep it should work as a UI plugin and not included in this PR.

@Rolv-Apneseth Rolv-Apneseth force-pushed the display-currently-selected-count branch from 40035fc to 458ca3b Compare February 15, 2024 12:35
@Rolv-Apneseth
Copy link
Contributor Author

Should be ready for you to review when you have the time @sxyazi , pretty small PR

yazi-plugin/preset/components/header.lua Outdated Show resolved Hide resolved
yazi-plugin/preset/components/header.lua Outdated Show resolved Hide resolved
yazi-plugin/preset/components/header.lua Outdated Show resolved Hide resolved
@Rolv-Apneseth
Copy link
Contributor Author

Yep those changes seem good. I do also like hiding the tab component if there's only one.

@sxyazi
Copy link
Owner

sxyazi commented Feb 15, 2024

Alright, I think there are no more problems here, let us merge it!

@sxyazi sxyazi merged commit b82587e into sxyazi:main Feb 15, 2024
5 checks passed
@Rolv-Apneseth Rolv-Apneseth deleted the display-currently-selected-count branch February 15, 2024 14:58
@Brixy
Copy link
Contributor

Brixy commented Feb 16, 2024

Thanks for the addition!

I noticed a tiny issue.

When you paste (y -> p) files anywhere the counter stays visible, which absolutely makes sense because you can paste to multiple locations using p without having to re-yank the original files.

Yet, when you move files (x -> p), the counter stays visible, although it is not possible to move the files again using p. In this case the counter should vanish, or it should be possible to move and then copy files using p multiple times.

(Tested with original config files.)

@sxyazi
Copy link
Owner

sxyazi commented Feb 17, 2024

@Brixy Thanks for the reporting, should also be fixed in #690

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants