[tests] Add testing of keyboard events in FullscreenRenderer.GetChar()

This contains one test case of each tcell.Key* event type that can be
sent to and subsequently processed in fzf's GetChar(). The test cases
describe status quo, and all of them PASS.

Small function util.ToTty() was added. It is similar to util.IsTty(),
but for stdout (hence the To preposition).
This commit is contained in:
Vlastimil Ovčáčík
2021-09-19 21:37:37 +02:00
committed by Junegunn Choi
parent 4173e94c6f
commit 00fb486f6a
3 changed files with 400 additions and 4 deletions

View File

@@ -117,11 +117,16 @@ func DurWithin(
return val
}
// IsTty returns true is stdin is a terminal
// IsTty returns true if stdin is a terminal
func IsTty() bool {
return isatty.IsTerminal(os.Stdin.Fd())
}
// ToTty returns true if stdout is a terminal
func ToTty() bool {
return isatty.IsTerminal(os.Stdout.Fd())
}
// Once returns a function that returns the specified boolean value only once
func Once(nextResponse bool) func() bool {
state := nextResponse