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.
()
| 1342 | // terminal to the former state when the program was running, and repaints. |
| 1343 | // Use it to reinitialize a Program after running ReleaseTerminal. |
| 1344 | func (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. |
no test coverage detected