Disable OnResize command on Windows

This commit is contained in:
Christian Rocha
2020-05-18 11:41:59 -04:00
parent d2ae1b0fb7
commit 61285e4e90
3 changed files with 32 additions and 16 deletions

View File

@@ -4,8 +4,6 @@ package boba
import (
"os"
"os/signal"
"syscall"
"time"
"golang.org/x/crypto/ssh/terminal"
@@ -62,17 +60,3 @@ func GetTerminalSize(newMsgFunc func(int, int, error) TerminalSizeMsg) Cmd {
return newMsgFunc(w, h, err)
}
}
// OnResize is used to listen for window resizes. Use GetTerminalSize to get
// the windows dimensions. We don't fetch the window size with this command to
// avoid a potential performance hit making the necessary system calls, since
// this command could potentially run a lot. On that note, consider debouncing
// this function.
func OnResize(newMsgFunc func() Msg) Cmd {
return func() Msg {
sig := make(chan os.Signal)
signal.Notify(sig, syscall.SIGWINCH)
<-sig
return newMsgFunc()
}
}