mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
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.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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user