package uvimport ()// SizeNotifier represents a notifier that listens for window size// changes using the SIGWINCH signal and notifies the given channel.typeSizeNotifierstruct {// Channel that receives terminal size change notifications.C <-chanos.Signalfterm.Filesigchanos.Signalmsync.Mutex}// NewSizeNotifier creates a new [SizeNotifier] that listens for window size// changes on the given TTY file through SIGWINCH signals.func ( term.File) *SizeNotifier {if == nil {panic("no file set") } := make(chanos.Signal)return &SizeNotifier{f: ,sig: ,C: , }}// Start starts listening for window size changes and notifies [SizeNotifier.C]// about any changes.func ( *SizeNotifier) () error {return .start()}// Stop stops the notifier and cleans up resources.func ( *SizeNotifier) () error {return .stop()}// GetWindowSize returns the current size of the terminal window.func ( *SizeNotifier) () ( Size, Size, error) {return .getWindowSize()}// GetSize returns the current cell size of the terminal window.func ( *SizeNotifier) () (, int, error) { .m.Lock()defer .m.Unlock() , , = term.GetSize(.f.Fd())if != nil {return0, 0, //nolint:wrapcheck }return , , nil}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)