fzf icon indicating copy to clipboard operation
fzf copied to clipboard

Option '--height' destroys results on stdout

Open doak opened this issue 4 years ago • 4 comments

  • [x] I have read through the manual page (man fzf)
  • [x] I have the latest version of fzf
  • [x] I have searched through the existing issues

Info

  • OS
    • [x] Linux
    • [ ] Mac OS X
    • [ ] Windows
    • [ ] Etc.
  • Shell
    • [x] bash
    • [ ] zsh
    • [ ] fish

Problem / Steps to reproduce

If running e.g. fzf --height=30% --bind=alt-enter:"execute(echo TEST)" and hitting alt-enter, the text TEST is not printed although the command seems to be executed (can be tested with e.g. touch). It works without the option --height. It also works if stdout is piped to a file directly (fzf [...] >/tmp/testfile), but it does not work if piped through cat (fzf [...] | cat).

doak avatar May 05 '20 12:05 doak

Perhaps related to #1247.

doak avatar May 11 '20 11:05 doak

Hi, I spend some time today debugging this and came to the same observation as this issue. @doak did you manage to find a workaround this (besides redirecting fzf's output?)

I think that the reason it works when redirecting to a file vs. to stdout is because in the latter case the output actually gets printed but it immediately gets overwritten by fzf trying to maintain the --height argument.

Nelyah avatar Jun 01 '21 20:06 Nelyah

Same problem here:

❯ echo -n "Select an option: " && seq 10 | fzf --height 30%
4

❯ echo -n "Select an option: " && seq 10 | fzf
Select an option: 4

It seems --height is performing some carriage return internally than clears current line

fernandomora avatar Nov 12 '21 11:11 fernandomora

Does not seems to be an issue on Windows. When switching to light renderer (i.e. height <=99), there is some garbage (maybe some escape code) printed before the text, but that's it. brokenprint (recording is 8 fps)

vovcacik avatar Nov 28 '21 14:11 vovcacik