ktr0731 / go-fuzzyfinder

fzf-like fuzzy-finder as a Go library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interaction between fuzzyfinder and subsequent STDIN usage

akerl-unpriv opened this issue · comments

Describe the bug

To reproduce

  1. Use this go code: https://gist.github.com/akerl-unpriv/d94d02cb21a333776d4ebaf2a24f8849
  2. go run main.go
  3. When prompted to make a select, make any selection from the fuzzy menu
  4. When prompted to enter text, type any text
  5. Hit enter.
  6. Type some more text.
  7. Hit enter again.

Expected behavior

You should never be able to make it to step 6/7; when you enter text at the prompt and hit enter, that text should be captured by ReadString. Instead, something seems to be interacting between Fuzzyfinder and STDIN, that causes the first text and newline to be swallowed.

Screenshots

Environment

  • OS: MacOS (tested on Catalina and Mojave)
  • Terminal: iTerm and native OSX Terminal, bash and zsh
  • go-fuzzyfinder version: v0.2.0

It seems like this may be linked to gdamore/tcell#194

commented

Thank you for reporting the issue.
Just you said, it is caused by gdamore/tcell's bug reported at gdamore/tcell#194 because the issue doesn't happen when using nsf/termbox-go.
One way to avoid the issue is to reverting #8 temporarily. We don't add any features depend on gdamore/tcell, so I think we can replace it without any side-effects.

commented

gdamore/tcell implementation has been reverted at v0.2.1.