I didn't realise at the time, but the tea.Program and the renderer share
the mutex. This make the code difficult to reason about - it turns out
the program sometimes acquires the lock and then calls the
`setAltScreen` method of the renderer which in turns calls `repaint`.
That causes a deadlock as `repaint` is trying to acquire the lock too.
* add: program.ReleaseTerminal and RestoreTerminal to re-use input & terminal
* chore(examples): add altscreen toggling to exec demo
* chore: put low-level altscreen stuff alongside other screen funcs
* docs: edit GoDocs for ReleaseTerminal and RestoreTerminal
* feat(renderer): add internal Msg renderMsg to immediately repaint
* fix: repaint instantly on RestoreTerminal
* fix: restore the altscreen state when restoring the terminal
* feat: implement Cmd-based API for blocking *exec.Cmds
* feat: allow Exec to return custom messages
* feat: allow Exec to be run without a callback
* fix: separate parameters for exec.Command examples
* fix: error message would get printed over by prompt in exec example
* fix: ignore signals while child process is running
* feat: allow to execute other things besides exec.Commands (#280)
* feat: allow to execute other things besides exec.Commands.
* fix: lint issues
* fix: renames, examples
* fix: callback type should be exported
* docs(exce): tiny ExecCommand doc comment correction
* chore(exec): break out Cmd for clarity's sake in example
* fix(exec): give the terminal a moment to catch up if exiting altscreen
* docs(exec): tidy up doc comments
* chore(exec): disambiguate methods for restoring the terminal state vs input
Co-authored-by: Christian Rocha <christian@rocha.is>
Co-authored-by: Carlos A Becker <caarlos0@gmail.com>
With this change all ANSI output will be piped through an ANSI compressor that
eliminates redundant ANSI sequences. As such the compressor can be considered
"lossless".
This commit also consolidates the exit operations for consistency's
sake, and adds a kill() method to renderers for stopping them without
performing any final rendering.
v0.13.4 introduced a regression where lines weren't always cleared when
resizing the window resulting in the presence of rendering artifacts.
This commit fixes that.
If the number of lines increased there's a chance that the increase in
lines caused the terminal to scroll (even in the altscreen). Because of
this we must repaint everything, as skipping lines will mis-render.
Thanks to @fiws for reporting this bug.
The Nil Renderer essentially disables the Bubble Tea renderer sending
loggings and print statements to stdout. It can be enabled via the
ProgramOption WithoutRenderer.