From e6e6e87463d4b1d3d8d5c129e4d008d35a1b5463 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 19 Jan 2011 05:55:02 +0100 Subject: [PATCH] Windows: fix window size getter bug --- lib/readline.js | 2 +- lib/tty_win32.js | 2 +- src/node_stdio_win32.cc | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/readline.js b/lib/readline.js index 2e03a9fa3c..7a022e7e69 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -54,7 +54,7 @@ function Interface(output, completer) { if (process.listeners('SIGWINCH').length === 0) { process.on('SIGWINCH', function() { - var winSize = tty.getWindowSize(0); + var winSize = tty.getWindowSize(output.fd); exports.columns = winSize[1]; }); } diff --git a/lib/tty_win32.js b/lib/tty_win32.js index 6902595a31..5f17193dea 100644 --- a/lib/tty_win32.js +++ b/lib/tty_win32.js @@ -27,7 +27,7 @@ function ReadStream(fd) { self.emit('data', dataUseString ? char : new Buffer(char, 'utf-8')); } } - function onResize(h, w) { + function onResize() { process.emit('SIGWINCH'); } diff --git a/src/node_stdio_win32.cc b/src/node_stdio_win32.cc index 30b572e51c..c4ba9ba516 100644 --- a/src/node_stdio_win32.cc +++ b/src/node_stdio_win32.cc @@ -546,10 +546,8 @@ static void tty_poll(EV_P_ ev_async *watcher, int revents) { case WINDOW_BUFFER_SIZE_EVENT: if (!tty_resize_callback) break; - argv[0] = Integer::New(input.Event.WindowBufferSizeEvent.dwSize.Y); - argv[1] = Integer::New(input.Event.WindowBufferSizeEvent.dwSize.X); callback = cb_unwrap(tty_resize_callback); - (*callback)->Call(global, 2, argv); + (*callback)->Call(global, 0, argv); break; } }