1 year ago

#96979

test-img

Aatif Syed

How does fzf manage stdin?

fzf fuzzily searches for a needle in a haystack. Consider the following snippet:

(sleep 5 && printf "this is some\ninput") | fzf

During the sleep, I'm still able to type things to fzf, and it understands them as the needle.

The piped input is correctly segregated, and fzf understand it as the haystack.

How does fzf tell the difference between the two? Is there somewhere simple in the source code I can look for clarity? Does this have anything to do with the alternate screen, which I think fzf is using?

Context here is a personally instructive re-implementation of fzf in python. Rough WIP is here.

terminal

posix

stdin

pty

fzf

0 Answers

Your Answer

Accepted video resources