Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions utils_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || (linux && !appengine) || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris

package readline
Expand Down Expand Up @@ -60,11 +61,14 @@ func GetStdin() int {
// -----------------------------------------------------------------------------

var (
widthChangeMutex sync.Mutex
widthChange sync.Once
widthChangeCallback func()
)

func DefaultOnWidthChanged(f func()) {
widthChangeMutex.Lock()
defer widthChangeMutex.Unlock()
widthChangeCallback = f
widthChange.Do(func() {
ch := make(chan os.Signal, 1)
Expand Down