mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 11:09:17 -07:00
* 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>
34 lines
936 B
Go
34 lines
936 B
Go
package tea
|
|
|
|
// renderer is the interface for Bubble Tea renderers.
|
|
type renderer interface {
|
|
// Start the renderer.
|
|
start()
|
|
|
|
// Stop the renderer, but render the final frame in the buffer, if any.
|
|
stop()
|
|
|
|
// Stop the renderer without doing any final rendering.
|
|
kill()
|
|
|
|
// Write a frame to the renderer. The renderer can write this data to
|
|
// output at its discretion.
|
|
write(string)
|
|
|
|
// Request a full re-render. Note that this will not trigger a render
|
|
// immediately. Rather, this method causes the next render to be a full
|
|
// repaint. Because of this, it's safe to call this method multiple times
|
|
// in succession.
|
|
repaint()
|
|
|
|
// Whether or not the alternate screen buffer is enabled.
|
|
altScreen() bool
|
|
|
|
// Record internally that the alternate screen buffer is enabled. This
|
|
// does not actually toggle the alternate screen buffer.
|
|
setAltScreen(bool)
|
|
}
|
|
|
|
// repaintMsg forces a full repaint.
|
|
type repaintMsg struct{}
|