Commit Graph

17 Commits

Author SHA1 Message Date
Ayman Bagabas e086d98172 feat: reduce console/term dependencies
Replace mattn/isatty and containerd/console with golang.org/x/term.

This mostly affects Windows. On Windows, unlike Unix, the console (TTY)
has different handles for input/output. Using the Console API, we need
to enable VT input on the input handle (CONIN) and VT processing on the
output handle (CONOUT). Doing so enables processing VT sequences on
Windows i.e. ANSI colors, mouse sequences, cursor movements, etc.

We already handle enabling VT processing for the program output using
Termenv `EnableVirtualTerminalProcessing`. For the input side, we enable
VT input right before setting the console to raw.

By doing this, we can drop both containerd/console and mattn/isatty.
2024-01-10 12:26:58 -05:00
Christian Rocha 5bc2504690 chore(lint): wrap various TTY-related errors 2023-07-07 16:30:57 +02:00
aklyachkin 2c7890bdf5 enable compilation on AIX 2022-07-29 15:58:06 +02:00
Christian Muehlhaeuser 3afda07603 Annotate why we ignore error 2022-01-07 13:25:29 -05:00
Erik G e402e8b567
Cancelable reads (#120)
This commit implements cancelable reads, which allows Bubble Tea programs to run in succession in a single application. It also makes sure all goroutines terminate before `Program.Start()` returns.

Closes #24.
2021-09-28 13:30:11 -04:00
Christian Rocha d1fb02c39d Use the hot, new Go 1.17 build tags syntax 2021-09-07 16:13:48 -04:00
Christian Rocha e1ca585c16 Simplify how we enable ANSI colors on Windows 2021-08-02 10:50:04 -04:00
Christian Rocha 9f9b3aea96 Read input regardless of whether or not it's a TTY
This commit also contains some refactors:

* Refactor away inputStatus type
* Refactor away program.inputIsTTY member
* Simplify how we setup and restore input when it's a TTY
2021-08-02 10:50:04 -04:00
Christian Rocha 0780601791 Open a TTY if input is not a TTY, unless the user has spec'd otherwise 2021-02-27 16:03:34 -05:00
Carlos Alexandro Becker b2d948b53c Fixed a couple of typos
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-01-17 15:58:50 +01:00
Christian Rocha 64da3bcf7a Use correct output when enabling ANSI colors on Windows (see #39) 2020-12-30 22:23:19 -05:00
Christian Rocha 4d14af713f
Remove pkg/term dependency 2020-10-13 12:55:38 -04:00
Christian Rocha 3b8b011b5a
Rename to Bubble Tea (with the import name tea) 2020-05-25 19:48:36 -04:00
Christian Rocha 4bf40fbe62
Rename project to Boba 2020-05-12 16:39:08 -04:00
Christian Muehlhaeuser bf92cd6cce
Add missing error handling 2020-04-17 20:35:54 +02:00
Christian Muehlhaeuser f382f4db4a
Move ansi helpers to termenv 2020-01-31 13:52:20 +01:00
Christian Muehlhaeuser bc67e3896b
Add platform-specific terminal init & restore 2020-01-25 07:15:29 +01:00