diff --git a/go.mod b/go.mod index 6e61cc4..a7a8085 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,9 @@ module github.com/orus-dev/osui go 1.23.1 +require golang.org/x/term v0.24.0 // direct + require ( + github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d // indirect golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // direct ) diff --git a/go.sum b/go.sum index b256fe0..8cf363c 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d h1:NqRhLdNVlozULwM1B3VaHhcXYSgrOAv8V5BE65om+1Q= +github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d/go.mod h1:cxIIfNMTwff8f/ZvRouvWYF6wOoO7nj99neWSx2q/Es= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= diff --git a/utils.go b/utils.go index db96c9f..eae16fc 100644 --- a/utils.go +++ b/utils.go @@ -9,6 +9,7 @@ import ( "runtime" "strings" + "github.com/nathan-fiscaletti/consolesize-go" "github.com/orus-dev/osui/colors" "golang.org/x/term" ) @@ -174,9 +175,5 @@ func LogicValueInt(b bool, _if, _else int) int { } func GetTerminalSize() (int, int) { - w, h, err := term.GetSize(int(os.Stdin.Fd())) - if err != nil { - panic(err) - } - return w, h + return consolesize.GetConsoleSize() }