diff options
author | Vlastimil Ovčáčík <vovcacik@github.ovcacik.org> | 2021-09-19 21:37:37 +0200 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2021-10-03 01:39:30 +0900 |
commit | 00fb486f6a5f90e92c60600103398553297fcd1c (patch) | |
tree | 716cd242274cae5e79ac5964d544411aaef27aaa /src/util | |
parent | 4173e94c6f260a64888928eead9aab8fd0bb1f97 (diff) |
[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).
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/util.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/util.go b/src/util/util.go index b3c32970..c16f1af0 100644 --- a/src/util/util.go +++ b/src/util/util.go @@ -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 |