* 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>
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.
The Nil Renderer essentially disables the Bubble Tea renderer sending
loggings and print statements to stdout. It can be enabled via the
ProgramOption WithoutRenderer.
Fix race by acquiring the mutex before accessing renderer.buf in flush.
WARNING: DATA RACE
Read at 0x00c0000ee0a0 by goroutine 11:
bytes.(*Buffer).Len()
/home/chlunde/opt/go/src/bytes/buffer.go:73 +0x64
github.com/charmbracelet/bubbletea.(*renderer).flush()
/home/chlunde/src/bubbletea/renderer.go:91 +0x45
github.com/charmbracelet/bubbletea.(*renderer).listen()
/home/chlunde/src/bubbletea/renderer.go:76 +0x185
Previous write at 0x00c0000ee0a0 by main goroutine:
bytes.(*Buffer).Reset()
/home/chlunde/opt/go/src/bytes/buffer.go:98 +0xf5
github.com/charmbracelet/bubbletea.(*renderer).write()
/home/chlunde/src/bubbletea/renderer.go:195 +0x13c
github.com/charmbracelet/bubbletea.(*Program).Start()
/home/chlunde/src/bubbletea/tea.go:330 +0xbbb
main.main()
/home/chlunde/src/bubbletea/examples/spinner/main.go:27 +0x229
Fixes#54