Browse Source

Windows: fix window size getter bug

v0.7.4-release
Bert Belder 14 years ago
committed by Ryan Dahl
parent
commit
e6e6e87463
  1. 2
      lib/readline.js
  2. 2
      lib/tty_win32.js
  3. 4
      src/node_stdio_win32.cc

2
lib/readline.js

@ -54,7 +54,7 @@ function Interface(output, completer) {
if (process.listeners('SIGWINCH').length === 0) { if (process.listeners('SIGWINCH').length === 0) {
process.on('SIGWINCH', function() { process.on('SIGWINCH', function() {
var winSize = tty.getWindowSize(0); var winSize = tty.getWindowSize(output.fd);
exports.columns = winSize[1]; exports.columns = winSize[1];
}); });
} }

2
lib/tty_win32.js

@ -27,7 +27,7 @@ function ReadStream(fd) {
self.emit('data', dataUseString ? char : new Buffer(char, 'utf-8')); self.emit('data', dataUseString ? char : new Buffer(char, 'utf-8'));
} }
} }
function onResize(h, w) { function onResize() {
process.emit('SIGWINCH'); process.emit('SIGWINCH');
} }

4
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: case WINDOW_BUFFER_SIZE_EVENT:
if (!tty_resize_callback) if (!tty_resize_callback)
break; 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 = cb_unwrap(tty_resize_callback);
(*callback)->Call(global, 2, argv); (*callback)->Call(global, 0, argv);
break; break;
} }
} }

Loading…
Cancel
Save