tiny fixes in tty_posix.js

Close #1158
Close #1160
Close #1252
v0.7.4-release
Yoshihiro KIKUCHI 2011-06-30 22:20:23 +09:00 committed by isaacs
parent e286480e34
commit 99b210d7ea
1 changed files with 3 additions and 3 deletions

View File

@ -71,14 +71,14 @@ function ReadStream(fd) {
} else { } else {
// Nobody's watching anyway // Nobody's watching anyway
self.removeListener('data', onData); self.removeListener('data', onData);
self.on('newlistener', onNewListener); self.on('newListener', onNewListener);
} }
} }
function onNewListener(event) { function onNewListener(event) {
if (event == 'keypress') { if (event == 'keypress') {
self.on('data', onData); self.on('data', onData);
self.removeListener('newlistener', onNewListener); self.removeListener('newListener', onNewListener);
} }
} }
@ -331,7 +331,7 @@ WriteStream.prototype.cursorTo = function(x, y) {
if (typeof x !== 'number') if (typeof x !== 'number')
throw new Error("Can't set cursor row without also setting it's column"); throw new Error("Can't set cursor row without also setting it's column");
if (typeof x === 'number') { if (typeof y !== 'number') {
this.write('\x1b[' + (x + 1) + 'G'); this.write('\x1b[' + (x + 1) + 'G');
} else { } else {
this.write('\x1b[' + (y + 1) + ';' + (x + 1) + 'H'); this.write('\x1b[' + (y + 1) + ';' + (x + 1) + 'H');