MCPcopy
hub / github.com/charmbracelet/bubbletea / flush

Method flush

tea.go:1221–1237  ·  view source on GitHub ↗

flush flushes the output buffer to the program output.

()

Source from the content-addressed store, hash-verified

1219
1220// flush flushes the output buffer to the program output.
1221func (p *Program) flush() error {
1222 p.mu.Lock()
1223 defer p.mu.Unlock()
1224
1225 if p.outputBuf.Len() == 0 {
1226 return nil
1227 }
1228 if p.logger != nil {
1229 p.logger.Printf("output: %q", p.outputBuf.String())
1230 }
1231 _, err := p.output.Write(p.outputBuf.Bytes())
1232 p.outputBuf.Reset()
1233 if err != nil {
1234 return fmt.Errorf("error writing to output: %w", err)
1235 }
1236 return nil
1237}
1238
1239// shutdown performs operations to free up resources and restore the terminal
1240// to its original state.

Callers 3

restoreTerminalStateMethod · 0.95
RestoreTerminalMethod · 0.95
startRendererMethod · 0.95

Calls 3

PrintfMethod · 0.80
WriteMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected