Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add 'exclude' action for excluding current/selected items from the result #4231

Merged
merged 5 commits into from
Feb 9, 2025

Conversation

junegunn
Copy link
Owner

@junegunn junegunn commented Feb 8, 2025

Close #4185

Summary

Add exclude action to make the current item or the selected items excluded from the result.

Discussion / Issues

  • exclude "excludes" the selected items (--multi) at once if there's any, instead of excluding the "current" item on the cursor. Is this acceptable, or should we have a separate action? i.e. exclude-current + exclude-selected. I prefer the current implementation.
    • Decided to add exclude and exclude-multi
  • The total item count does not decrease on exclude. I think this has a value of indicating that some items are excluded, as opposed to the list being fully "reloaded."
  • To avoid the overhead of locking, we copy the exclusion list before passing it to the matcher. This is fine for small lists. But it does have performance problem if the exclusion list becomes excessively large.
    # But realistically, who would do this?
    seq 10000000 | fzf --sync --multi --bind start:select-all+exclude-multi

@junegunn junegunn self-assigned this Feb 8, 2025
@junegunn
Copy link
Owner Author

junegunn commented Feb 9, 2025

I'll be renaming it to drop or exclude.

@junegunn junegunn changed the title Add 'deny' action for excluding current/selected items from the result Add 'exclude' action for excluding current/selected items from the result Feb 9, 2025
@junegunn junegunn merged commit 67dd7e1 into master Feb 9, 2025
7 checks passed
@junegunn junegunn deleted the devel branch February 9, 2025 04:22
@junegunn
Copy link
Owner Author

junegunn commented Feb 9, 2025

On second thought, I think we need exclude-current that doesn't affect the selection.

  • You are given a list, and you want to select some items.
  • You carefully go through the list, select items one by one.
  • You sometimes want to remove the items that you're never going to choose from the list.
    • But you don't want to lose the previous selections!

junegunn added a commit that referenced this pull request Feb 9, 2025
@junegunn
Copy link
Owner Author

junegunn commented Feb 9, 2025

On third thought, I think we should have exclude and exclude-multi instead of exclude-current and exclude.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Action to remove/pop entries in the list
1 participant