MCPcopy
hub / github.com/gdamore/tcell / NotifyResize

Method NotifyResize

tty/tty_unix.go:166–193  ·  view source on GitHub ↗
(resizeQ chan<- bool)

Source from the content-addressed store, hash-verified

164}
165
166func (tty *devTty) NotifyResize(resizeQ chan<- bool) {
167
168 sigQ := tty.sig
169 tty.sig = nil
170
171 if sigQ != nil {
172 signal.Stop(sigQ)
173 close(sigQ)
174 }
175
176 if resizeQ == nil {
177 return
178 }
179
180 sigQ = make(chan os.Signal, 1)
181 signal.Notify(sigQ, syscall.SIGWINCH)
182
183 tty.sig = sigQ
184
185 go func() {
186 for range sigQ {
187 select {
188 case resizeQ <- true:
189 default: // queue full, so nvm.
190 }
191 }
192 }()
193}
194
195// NewDevTty opens a /dev/tty based Tty.
196func NewDevTty() (Tty, error) {

Callers 1

StopMethod · 0.95

Calls 1

StopMethod · 0.65

Tested by

no test coverage detected