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

Method RestoreTerminal

tea.go:1344–1366  ·  view source on GitHub ↗

RestoreTerminal reinitializes the Program's input reader, restores the terminal to the former state when the program was running, and repaints. Use it to reinitialize a Program after running ReleaseTerminal.

()

Source from the content-addressed store, hash-verified

1342// terminal to the former state when the program was running, and repaints.
1343// Use it to reinitialize a Program after running ReleaseTerminal.
1344func (p *Program) RestoreTerminal() error {
1345 atomic.StoreUint32(&p.ignoreSignals, 0)
1346
1347 if err := p.initTerminal(); err != nil {
1348 return err
1349 }
1350 if p.input != nil {
1351 if err := p.initInputReader(false); err != nil {
1352 return err
1353 }
1354 }
1355
1356 p.startRenderer()
1357
1358 // If the output is a terminal, it may have been resized while another
1359 // process was at the foreground, in which case we may not have received
1360 // SIGWINCH. Detect any size change now and propagate the new size as
1361 // needed.
1362 go p.checkResize()
1363
1364 // Flush queued commands.
1365 return p.flush()
1366}
1367
1368// Println prints above the Program. This output is unmanaged by the program
1369// and will persist across renders by the Program.

Callers 2

suspendMethod · 0.95
execMethod · 0.95

Calls 5

initTerminalMethod · 0.95
initInputReaderMethod · 0.95
startRendererMethod · 0.95
checkResizeMethod · 0.95
flushMethod · 0.95

Tested by

no test coverage detected