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

Method initInput

tty_unix.go:15–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13)
14
15func (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
37const suspendSupported = true
38

Callers 1

initTerminalMethod · 0.95

Calls 1

Tested by

no test coverage detected