mscdex / node-ncurses

An ncurses binding for node.js
MIT License
386 stars 25 forks source link

Escape key is terribly slow on OSX #20

Closed redchair123 closed 11 years ago

redchair123 commented 11 years ago

For some reason, processing the escape key is much slower than processing other keys

To demonstrate: on line 90 of the irc.client.js there is a line

 if (i === nc.keys.ESC) {

Replace that with

 if (i === nc.keys.ESC || i === 7) {

(7 matches for control G).

the escape is processed a full second slower than the ^G.

To verify that this is indeed not a quirk in osx, I tested another ncurses application that uses the native bindings (sc: http://www.ibiblio.org/pub/Linux/apps/financial/spreadsheet/sc-7.16.lsm) and the delay doesn't show up there.

mscdex commented 11 years ago

This is because the terminal waits to see if it is just an ESC/ALT press or is actually a key combo press (e.g. ESC-1, ALT-F, etc.). This behavior is configurable by ncurses though.

I suppose I could expose a function to change this behavior.

redchair123 commented 11 years ago
I suppose I could expose a function to change this behavior.

That would be ideal.

mscdex commented 11 years ago

@Niggler Added in 87d2a8e