()
| 13 | ) |
| 14 | |
| 15 | func (p *Program) initInput() (err error) { |
| 16 | // Check if input is a terminal |
| 17 | if f, ok := p.input.(term.File); ok && term.IsTerminal(f.Fd()) { |
| 18 | p.ttyInput = f |
| 19 | p.previousTtyInputState, err = term.MakeRaw(p.ttyInput.Fd()) |
| 20 | if err != nil { |
| 21 | return fmt.Errorf("error entering raw mode: %w", err) |
| 22 | } |
| 23 | |
| 24 | // OPTIM: We can use hard tabs and backspaces to optimize cursor |
| 25 | // movements. This is based on termios settings support and whether |
| 26 | // they exist and enabled. |
| 27 | p.checkOptimizedMovements(p.previousTtyInputState) |
| 28 | } |
| 29 | |
| 30 | if f, ok := p.output.(term.File); ok && term.IsTerminal(f.Fd()) { |
| 31 | p.ttyOutput = f |
| 32 | } |
| 33 | |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | const suspendSupported = true |
| 38 |
no test coverage detected