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

Method checkResize

tty.go:109–127  ·  view source on GitHub ↗

checkResize detects the current size of the output and informs the program via a WindowSizeMsg.

()

Source from the content-addressed store, hash-verified

107// checkResize detects the current size of the output and informs the program
108// via a WindowSizeMsg.
109func (p *Program) checkResize() {
110 if p.ttyOutput == nil {
111 // can't query window size
112 return
113 }
114
115 w, h, err := term.GetSize(p.ttyOutput.Fd())
116 if err != nil {
117 select {
118 case <-p.ctx.Done():
119 case p.errs <- err:
120 }
121
122 return
123 }
124
125 p.width, p.height = w, h
126 p.Send(WindowSizeMsg{Width: w, Height: h})
127}
128
129// OpenTTY opens the running terminal's TTY for reading and writing.
130func OpenTTY() (*os.File, *os.File, error) {

Callers 3

eventLoopMethod · 0.95
RestoreTerminalMethod · 0.95
listenForResizeMethod · 0.95

Calls 1

SendMethod · 0.95

Tested by

no test coverage detected