From d08250c5e8bb6a7eb6309b2954fbc521b29ef68d Mon Sep 17 00:00:00 2001 From: qxxt <57898942+qxxt@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:54:09 +0700 Subject: [PATCH] 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. --- term_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/term_unix.go b/term_unix.go index a4e31ab..62c2b3f 100644 --- a/term_unix.go +++ b/term_unix.go @@ -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 }