Skip to content

Conversation

@gpanders
Copy link
Contributor

@gpanders gpanders commented Oct 14, 2019

This enables multi-select in fzy with the Ctrl+t key. Pressing Ctrl+t on an item will make that item bold. Pressing Ctrl+t will de-select it. When at least one item is multi-selected, pressing the Return key will print each multi-selected item on its own line to stdout (this mimics the behavior of fzf's multi-select feature).

EDIT: Updated the key binding to Ctrl+t.

@max-baz
Copy link

max-baz commented Oct 15, 2019

Nice work! I only want to point out that Ctrl-s is an unfortunate shortcut, because pressing Ctrl-s makes my terminal hang (and requires pressing Ctrl-q to unblock it). While searching for what's going on I discovered that running stty -ixon disables the "hang" functionality and therefore allows fzy to intercept and react on pressing Ctrl-s, but given that many people would probably stumble upon this issue as well, maybe we can choose a more "friendly" default shortcut.

@gpanders
Copy link
Contributor Author

gpanders commented Oct 15, 2019 via email

@max-baz
Copy link

max-baz commented Oct 15, 2019

I would probably vote for Ctrl+Space as it's easier to type, but Ctrl+t sounds OK too.

Have you considered moving the selection down when you press the "select" shortcut? So that when you run echo 'a\nb\nc\nd' | ./fzy pressing Ctrl+Space three times would select a, b and c?

@max-baz
Copy link

max-baz commented Oct 15, 2019

Here's a small bug I discovered:

  1. Run echo 'a\nb\nc\nd' | ./fzy
  2. Type aa<Ctrl-s><Backspace><Enter>
[1]    566797 done                              echo 'a\nb\nc\nd' | 
       566798 segmentation fault (core dumped)  ./fzy

@gpanders
Copy link
Contributor Author

gpanders commented Oct 15, 2019 via email

@max-baz
Copy link

max-baz commented Oct 15, 2019

I was on master but I switched to multiselect branch and still can reproduce this every time

@max-baz
Copy link

max-baz commented Oct 15, 2019

What is printed for you in this case, aa?

@gpanders
Copy link
Contributor Author

gpanders commented Oct 15, 2019 via email

@max-baz
Copy link

max-baz commented Oct 15, 2019

Thanks, with the latest code everything works well now, and I love how Ctrl-t scrolls and even wraps to the first entry when you select the last one 👍

Great job!

Default multi-select key is Ctrl+s
Allocate memory for the multiselect buffer in chunks, similar to how the
`choices` buffer is resized. This results in potentially more unused
(i.e. wasted) memory, but in fewer invocations of `malloc`/`realloc`,
which is probably more important, considering the size of the
multiselect array will never be that large.
@ghost

This comment has been minimized.

@alexchomiak
Copy link

@jhawthorn

Any update on when/if this will be pushed into master? This is a great feature.

@Soundtoxin
Copy link

Why was C-t chosen over the tab key (what fzf uses)?

@unrealapex
Copy link

Using Tab would cause a conflict because it is bound to replace the current search string with the selected item.

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.

5 participants