restoreInput restores the tty input to its original state.
()
| 39 | |
| 40 | // restoreInput restores the tty input to its original state. |
| 41 | func (p *Program) restoreInput() error { |
| 42 | if p.ttyInput != nil && p.previousTtyInputState != nil { |
| 43 | if err := term.Restore(p.ttyInput.Fd(), p.previousTtyInputState); err != nil { |
| 44 | return fmt.Errorf("bubbletea: error restoring console: %w", err) |
| 45 | } |
| 46 | } |
| 47 | if p.ttyOutput != nil && p.previousOutputState != nil { |
| 48 | if err := term.Restore(p.ttyOutput.Fd(), p.previousOutputState); err != nil { |
| 49 | return fmt.Errorf("bubbletea: error restoring console: %w", err) |
| 50 | } |
| 51 | } |
| 52 | return nil |
| 53 | } |
| 54 | |
| 55 | // initInputReader (re)commences reading inputs. |
| 56 | func (p *Program) initInputReader(cancel bool) error { |
no outgoing calls
no test coverage detected