Permalink
Browse files

Add function to set ESC delay

  • Loading branch information...
1 parent c42e2d8 commit 87d2a8e9cf87bbdd762af9b4c9e9df9bdbe76d85 @mscdex committed Oct 2, 2012
Showing with 17 additions and 0 deletions.
  1. +2 −0 README.md
  2. +15 −0 src/binding.cc
View
@@ -48,6 +48,8 @@ Module Functions
* **colorBg**(<_Integer_>colorPair) - _Integer_ - Returns the background color currently set for the given color pair number.
+* **setEscDelay**(<_Integer_>delay) - _(void)_ - Sets the duration (in milliseconds) to wait after ESC is pressed.
+
* **cleanup**() - _(void)_ - Restores the terminal after using ncurses. This function is automatically called when the last window is closed and thus should never be used except when handling unexpected exceptions (i.e. in node.js's uncaughtException event) so that you can safely restore the terminal back to normal.
* **redraw**() - _(void)_ - Redraws all windows.
View
@@ -455,6 +455,7 @@ class Window : public ObjectWrap {
target->SetAccessor(keys_symbol, KeyConstsGetter);
target->SetAccessor(colors_symbol, ColorConstsGetter);
target->SetAccessor(attrs_symbol, AttrConstsGetter);
+ NODE_SET_METHOD(target, "setEscDelay", Setescdelay);
NODE_SET_METHOD(target, "cleanup", Resetscreen);
NODE_SET_METHOD(target, "redraw", Redraw);
NODE_SET_METHOD(target, "leave", LeaveNcurses);
@@ -1772,6 +1773,20 @@ class Window : public ObjectWrap {
return Undefined();
}
+ static Handle<Value> Setescdelay (const Arguments& args) {
+ HandleScope scope;
+
+ if (args.Length() == 0 || !args[0]->IsInt32()) {
+ return ThrowException(Exception::Error(
+ String::New("Invalid argument")
+ ));
+ }
+
+ ::set_escdelay(args[0]->Int32Value());
+
+ return Undefined();
+ }
+
static Handle<Value> LeaveNcurses (const Arguments& args) {
HandleScope scope;

0 comments on commit 87d2a8e

Please sign in to comment.