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

Draft: Introduce --print-selected-count #2172

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

resolritter
Copy link

Disclaimer: I know this is missing tests, documentation, indentation, etc... which is why I'm opening this as a Draft first. I'd like to know if you are willing to accept this solution before going further with the rest.

Problem

Since FZF falls back to the current item even if nothing is selected, there's no way to differentiate between the two situations:

  • In multi-mode, one item was selected and FZF exited with it
  • No item was selected, but the item under the cursor was chosen as a fallback

fzf/src/terminal.go

Lines 577 to 578 in 0db65c2

if !found {
current := t.currentItem()

Solution

This MR would introduce a print-selected-count option, which is useful to disambiguate, in multi selection mode, if an "expected" binding has exited with an explicit multi-selection instead of the aforementioned fallback behavior.

At the same time, this would also be useful for some other use-case which would like to have the result count without extra post-processing.

@resolritter resolritter marked this pull request as draft September 6, 2020 18:27
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