From 71bab26bf4bcd9f96efded7e02765b7be0e425b1 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 12 Oct 2011 18:32:31 -0700 Subject: Get window size properly --- lib/search.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/search.js') diff --git a/lib/search.js b/lib/search.js index a9081bed7..0e88ee783 100644 --- a/lib/search.js +++ b/lib/search.js @@ -121,10 +121,10 @@ function filterWords (data, args, notArgs) { function prettify (data, args) { try { var tty = require("tty") - , cols = tty.isatty(1) ? - ( tty.getWindowSize ? tty.getWindowSize()[1] - : Infinity ) - : Infinity + , stdout = process.stdout + , cols = !tty.isatty(stdout.fd) ? Infinity + : stdout._handle ? stdout._handle.getWindowSize()[0] + : tty.getWindowSize()[1] } catch (ex) { cols = Infinity } // name, desc, author, keywords -- cgit v1.2.3