Bind uv_tty_get_winsize
This commit is contained in:
parent
1de156abb1
commit
e1dc6e6d73
@ -95,12 +95,12 @@ function Interface(input, output, completer) {
|
|||||||
this.history = [];
|
this.history = [];
|
||||||
this.historyIndex = -1;
|
this.historyIndex = -1;
|
||||||
|
|
||||||
var winSize = tty.getWindowSize(output.fd);
|
var winSize = output.getWindowSize();
|
||||||
exports.columns = winSize[1];
|
exports.columns = winSize[1];
|
||||||
|
|
||||||
if (process.listeners('SIGWINCH').length === 0) {
|
if (process.listeners('SIGWINCH').length === 0) {
|
||||||
process.on('SIGWINCH', function() {
|
process.on('SIGWINCH', function() {
|
||||||
var winSize = tty.getWindowSize(output.fd);
|
var winSize = output.getWindowSize();
|
||||||
exports.columns = winSize[1];
|
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 {
|
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::Object;
|
||||||
using v8::Handle;
|
using v8::Handle;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
@ -31,6 +21,16 @@ using v8::Arguments;
|
|||||||
using v8::Integer;
|
using v8::Integer;
|
||||||
using v8::Undefined;
|
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 {
|
class TTYWrap : StreamWrap {
|
||||||
public:
|
public:
|
||||||
@ -115,15 +115,7 @@ class TTYWrap : StreamWrap {
|
|||||||
static Handle<Value> SetRawMode(const Arguments& args) {
|
static Handle<Value> SetRawMode(const Arguments& args) {
|
||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
|
|
||||||
assert(!args.Holder().IsEmpty());
|
UNWRAP
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
int r = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());
|
int r = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user