From 99e4cddf06d280b24feae2cbc2d4be63d81eefd1 Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Wed, 16 Oct 2013 18:05:06 +0200 Subject: [PATCH] Fixed an error on the line ending of stty. --- menu.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/menu.go b/menu.go index 07c3679..50aa79d 100644 --- a/menu.go +++ b/menu.go @@ -16,9 +16,10 @@ func terminalSize() (width, height int) { cmd := exec.Command("stty", "size") cmd.Stdin = os.Stdin out, _ := cmd.Output() - sizes := strings.Split(string(out), " ") - width, _ = strconv.Atoi(sizes[1]) - height, _ = strconv.Atoi(sizes[0]) + sizes := strings.Trim(string(out), "\n") + size := strings.Split(sizes, " ") + width, _ = strconv.Atoi(size[1]) + height, _ = strconv.Atoi(size[0]) return width, height }