From 57fa247f53bccf5cb34d3dc23b8316600b4b7878 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 7 Feb 2011 13:46:15 -0800 Subject: [PATCH] Closes GH-645. Document tty.getWindowSize --- doc/api/tty.markdown | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/doc/api/tty.markdown b/doc/api/tty.markdown index 5a6ae7923a..a1bd143363 100644 --- a/doc/api/tty.markdown +++ b/doc/api/tty.markdown @@ -25,16 +25,13 @@ terminal. process's stdin fd to act either as a raw device or default. -### tty.getColumns() +### tty.setWindowSize(fd, row, col) -Returns the number of columns associated with the current process's TTY. +`ioctl`s the window size settings to the file descriptor. -Note that each time this number is changed the process receives a `SIGWINCH` -signal. So you can keep a cache of it like this: - var columns = tty.getColumns(); - process.on('SIGWINCH', function() { - columns = tty.getColumns(); - }); +### tty.getWindowSize(fd) + +Returns `[row, col]` for the TTY associated with the file descriptor.