Consistent error value return for Getsize()

All other platform have return value of 0 for error when trying to get the terminal size while unix have -1. That makes it hard to catch whether the value passed from it was inserted on purpose.
This commit is contained in:
qxxt
2021-12-21 18:54:09 +07:00
committed by GitHub
parent 03fcf44c22
commit d08250c5e8

View File

@@ -60,7 +60,7 @@ func restore(fd int, state *State) error {
func getSize(fd int) (width, height int, err error) {
ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return -1, -1, err
return 0, 0, err
}
return int(ws.Col), int(ws.Row), nil
}