Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Bind uv_tty_get_winsize

  • Loading branch information...
ry committed Sep 23, 2011
1 parent fdeddb6 commit 0c4a42478379699fe9dd7ca062f27665e86afb4f
Showing with 17 additions and 21 deletions.
  1. +2 −2 lib/readline.js
  2. +4 −0 lib/tty_uv.js
  3. +11 −19 src/tty_wrap.cc
@@ -95,12 +95,12 @@ function Interface(input, output, completer) {
this.history = [];
this.historyIndex = -1;

var winSize = tty.getWindowSize(output.fd);
var winSize = output.getWindowSize();
exports.columns = winSize[1];

if (process.listeners('SIGWINCH').length === 0) {
process.on('SIGWINCH', function() {
var winSize = tty.getWindowSize(output.fd);
var winSize = output.getWindowSize();
exports.columns = winSize[1];
});
}
@@ -369,3 +369,7 @@ WriteStream.prototype.clearLine = function(dir) {
}
};


WriteStream.prototype.getWindowSize = function() {
return this._handle.getWindowSize();
};
@@ -6,16 +6,6 @@

namespace node {

#define UNWRAP \
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
TTYWrap* wrap = \
static_cast<TTYWrap*>(args.Holder()->GetPointerFromInternalField(0)); \
if (!wrap) { \
SetErrno(UV_EBADF); \
return scope.Close(Integer::New(-1)); \
}

using v8::Object;
using v8::Handle;
using v8::Local;
@@ -31,6 +21,16 @@ using v8::Arguments;
using v8::Integer;
using v8::Undefined;

#define UNWRAP \
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
TTYWrap* wrap = \
static_cast<TTYWrap*>(args.Holder()->GetPointerFromInternalField(0)); \
if (!wrap) { \
SetErrno(UV_EBADF); \
return scope.Close(Integer::New(-1)); \
}


class TTYWrap : StreamWrap {
public:
@@ -115,15 +115,7 @@ class TTYWrap : StreamWrap {
static Handle<Value> SetRawMode(const Arguments& args) {
HandleScope scope;

assert(!args.Holder().IsEmpty());
assert(args.Holder()->InternalFieldCount() > 0);
TTYWrap* wrap =
static_cast<TTYWrap*>(args.Holder()->GetPointerFromInternalField(0));

if (!wrap) {
SetErrno(UV_EBADF);
return scope.Close(Integer::New(-1));
}
UNWRAP

int r = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());

0 comments on commit 0c4a424

Please sign in to comment.
You can’t perform that action at this time.