Commit Graph

14 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 Muehlhaeuser 6c449e55bf feat: use Termenv.Output to write to tty 2022-09-27 02:49:36 +02:00
Christian Rocha ab60d776f1 Add missing Go 1.17 build tags in Windows files 2021-10-02 21:13:03 -04:00
Christian Rocha 5f41a91e02 Fix Windows stuff related to the refactor at 49a5d16 2021-08-02 10:50:04 -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
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 9c9a92c349
Add Windows support 2020-10-12 23:14:55 -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 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