Documentation
¶
Overview ¶
Terminal output stage that turns Bubble Tea views into the fewest bytes a measured terminal needs
Index ¶
- Constants
- Variables
- func Exec(cmd *exec.Cmd, fn func(error) tea.Msg) tea.Cmd
- func JobControl() bool
- func Suspend(line string) tea.Cmd
- type Cell
- type Color
- type Frame
- type FrameStat
- type GoneMsg
- type Program
- type Renderer
- func (r *Renderer) Clear()
- func (r *Renderer) Err() error
- func (r *Renderer) Flush(now time.Time) time.Duration
- func (r *Renderer) Hold()
- func (r *Renderer) Loop(interval time.Duration, done <-chan struct{})
- func (r *Renderer) Release()
- func (r *Renderer) Render(v tea.View)
- func (r *Renderer) Reply(msg tea.Msg) bool
- func (r *Renderer) Resize(w, h int)
- func (r *Renderer) SetProfile(p colorprofile.Profile)
- func (r *Renderer) Unhold()
- func (r *Renderer) Write(p []byte) (int, error)
- type Style
- type SuspendRefusedMsg
- type TerminateMsg
Constants ¶
const ( AttrBold uint8 = 1 << iota AttrFaint AttrItalic AttrBlink AttrRapidBlink AttrReverse AttrConceal AttrStrike )
Text attributes a cell carries
const ( UnderNone uint8 = iota UnderSingle UnderDouble UnderCurly UnderDotted UnderDashed )
Underline shapes
Variables ¶
var ErrTerminalGone = errors.New("tty: the terminal is gone")
Failure of a program whose terminal went away under it
Functions ¶
func Exec ¶
Runs a command on the terminal, the program paused and its screen given back, fn's message delivered after
func JobControl ¶
func JobControl() bool
Whether a shell's job control can stop and continue this process group, false for a group the kernel holds orphaned
Types ¶
type Cell ¶
One grid column, a cluster's first column holding its text and width, the rest holding width zero
type Color ¶
type Color uint32
Color packed as a kind byte over a palette index or 24 bit RGB, zero for the default
type FrameStat ¶
type FrameStat struct {
At time.Time
// Time the model took to build the view the frame shows
View time.Duration
// Time the renderer took to turn the view into bytes
Compose time.Duration
// Time the terminal took to accept the bytes
Write time.Duration
Bytes int
}
Timing of one frame the renderer wrote to the terminal
type GoneMsg ¶
type GoneMsg struct{ Err error }
Loss of the terminal without a hangup signal, every write to it failing, that the model answers by ending the program
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Bubble Tea program whose terminal bytes, modes, size, job control and restore tty owns
func NewProgram ¶
Program for the model, run on the process's terminal until it quits or ctx ends
func (*Program) OnFrame ¶
Has fn told the timing of every frame written to the terminal, set before Run
func (*Program) OnPanic ¶
Has fn told the value of a panic in the model before the program reports it and ends, set before Run
func (*Program) Run ¶
Runs the program until it quits, the terminal restored before anything it wrote to stderr is shown
func (*Program) Send ¶
Sends a message to the model, waiting until the program runs and dropping it once the program ended
func (*Program) Terminated ¶
Signal of the operating system that ended the program, zero when it ended on its own
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Turns views into terminal bytes for one terminal, measuring the widths it draws before trusting them
func NewRenderer ¶
Renderer writing to the terminal, sized w by h
func (*Renderer) Clear ¶
func (r *Renderer) Clear()
Clears the terminal and repaints the whole frame at the next write
func (*Renderer) Flush ¶
Writes whatever the terminal lacks, returning how long until a probe deadline wants another write, zero for none
func (*Renderer) Hold ¶
func (r *Renderer) Hold()
Stops writing frames until Unhold, the terminal belonging to someone else meanwhile
func (*Renderer) Release ¶
func (r *Renderer) Release()
Undoes everything the session set and tells the guard nothing is left to undo, the renderer ready to enter again
func (*Renderer) Reply ¶
Takes a terminal answer, reporting whether it was one tty asked for and so is no business of the program
func (*Renderer) SetProfile ¶
func (r *Renderer) SetProfile(p colorprofile.Profile)
Sets the color profile cells are mapped into
type SuspendRefusedMsg ¶
type SuspendRefusedMsg struct{}
Answer to a suspend the program refused with the terminal untouched, no shell job control holding its process group
type TerminateMsg ¶
Stop request of the operating system, an interrupt, a terminate or a hangup, that the model answers by ending the program