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