Commit graph

8 commits

Author SHA1 Message Date
Ayman Bagabas
d1fa13cdba
fix: reset renderer and cursor when releasing terminal (#1321)
The cursed renderer moves the cursor between renders, which can cause
issues when the terminal is released and restored. For instance, when
we exec a command using tea.Exec, we want the cursor position to remain
the same after the command finishes and goes back to the same position
as before the command was executed.

With tea.Suspend on the other hand, we want to make sure we reset the
cursor position because the program stops executing and is put to
suspend. Resuming the program again initializes the renderer and its
cursor position again from scratch as if it was a new program.

This wasn't an issue for the standard renderer because we always put the
cursor at the lower left corner of the screen. Releasing and restoring
the program wasn't an issue because the cursor was always at the same
position.
2025-02-11 12:29:34 -05:00
Ayman Bagabas
9636413107 fix: use safeWriter to guard writing to output
This implements a wrapper around p.output that locks the output on every
write. We also need to redefine `channelHandlers` to be thread-safe
since `p.Kill()` can be called from a different thread while the program
is running.
2024-09-12 13:22:33 -04:00
Ayman Bagabas
cb801d8f2c
refactor: use x/term and x/ansi for renderer sequences (#962)
* refactor: use x/exp/term for renderer sequences

This replaces termenv.Output with raw sequences and a bytes.Buffer to
handle vt screen and cursor events.

* chore: update dependencies

* refactor: use x/term
2024-05-21 14:46:11 -04:00
Christian Muehlhaeuser
741f2d37f0 fix: pass actual stdout's fd to command 2022-11-01 00:21:02 +01:00
Josh Soref
4aa9ce489b
docs: fix spelling / various typos (#526) 2022-10-11 14:40:01 +02:00
Dakota Walsh
f905b97756 docs: fix typo
The previous example was wrong and would result in the following
compiler error:
error (type) is not an expression

Just a simple typo, I've changed it to err to correctly reference the
function scoped variable named err.
2022-08-27 10:22:11 +02:00
Christian Muehlhaeuser
1e1b5f716d chore: gofmt sources 2022-08-15 12:25:55 +02:00
Christian Rocha
775dbfbeff
chore(exec): small API edits (#323)
* feat: add OSExec helper function for running exec.Cmds

* chore: for now, un-expose WrapExecCommand

* chore: move exec struff into its own file

* chore(exec): better name for Exec func that wraps exec.Cmd (thanks, @toby)
2022-06-01 17:12:21 -07:00