Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-10-13 05:32:31 +0400
committerisaacs <i@izs.me>2011-10-13 05:32:31 +0400
commit71bab26bf4bcd9f96efded7e02765b7be0e425b1 (patch)
treee34f5e7df7a809b42826dbb6c79efe63b5eccb8b /lib/search.js
parent0adc1623deea065aee1f86ee49a512d1e6972e0d (diff)
Get window size properly
Diffstat (limited to 'lib/search.js')
-rw-r--r--lib/search.js8
1 files changed, 4 insertions, 4 deletions
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