parent
ce59050ded
commit
b4fb673943
|
@ -16,7 +16,6 @@ var EventEmitter = require('events').EventEmitter
|
||||||
|
|
||||||
var Tput = require('./tput')
|
var Tput = require('./tput')
|
||||||
, colors = require('./colors')
|
, colors = require('./colors')
|
||||||
, helpers = require('./helpers')
|
|
||||||
, slice = Array.prototype.slice;
|
, slice = Array.prototype.slice;
|
||||||
|
|
||||||
var nextTick = global.setImmediate || process.nextTick.bind(process);
|
var nextTick = global.setImmediate || process.nextTick.bind(process);
|
||||||
|
@ -325,8 +324,8 @@ Program.prototype.listen = function() {
|
||||||
this.on('newListener', this._newHandler = function fn(type) {
|
this.on('newListener', this._newHandler = function fn(type) {
|
||||||
if (type === 'keypress' || type === 'mouse') {
|
if (type === 'keypress' || type === 'mouse') {
|
||||||
self.removeListener('newListener', fn);
|
self.removeListener('newListener', fn);
|
||||||
if (helpers.hasRaw(self.input) && !helpers.isRaw(self.input)) {
|
if (self.input.setRawMode && !self.input.isRaw) {
|
||||||
helpers.setRawMode(self.input, true);
|
self.input.setRawMode(true);
|
||||||
self.input.resume();
|
self.input.resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +401,7 @@ Program.prototype._listenInput = function() {
|
||||||
Program.prototype._listenOutput = function() {
|
Program.prototype._listenOutput = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!helpers.isTTY(this.output)) {
|
if (!this.output.isTTY) {
|
||||||
nextTick(function() {
|
nextTick(function() {
|
||||||
self.emit('warning', 'Output is not a TTY');
|
self.emit('warning', 'Output is not a TTY');
|
||||||
});
|
});
|
||||||
|
@ -464,9 +463,9 @@ Program.prototype.destroy = function() {
|
||||||
delete this.input._keypressHandler;
|
delete this.input._keypressHandler;
|
||||||
delete this.input._dataHandler;
|
delete this.input._dataHandler;
|
||||||
|
|
||||||
if (helpers.hasRaw(this.input)) {
|
if (this.input.setRawMode) {
|
||||||
if (helpers.isRaw(this.input)) {
|
if (this.input.isRaw) {
|
||||||
helpers.setRawMode(this.input, false);
|
this.input.setRawMode(false);
|
||||||
}
|
}
|
||||||
if (!this.input.destroyed) {
|
if (!this.input.destroyed) {
|
||||||
this.input.pause();
|
this.input.pause();
|
||||||
|
@ -4178,16 +4177,16 @@ Program.prototype.pause = function(callback) {
|
||||||
|
|
||||||
var write = this.output.write;
|
var write = this.output.write;
|
||||||
this.output.write = function() {};
|
this.output.write = function() {};
|
||||||
if (helpers.hasRaw(this.input)) {
|
if (this.input.setRawMode) {
|
||||||
helpers.setRawMode(this.input, false);
|
this.input.setRawMode(false);
|
||||||
}
|
}
|
||||||
this.input.pause();
|
this.input.pause();
|
||||||
|
|
||||||
return this._resume = function() {
|
return this._resume = function() {
|
||||||
delete self._resume;
|
delete self._resume;
|
||||||
|
|
||||||
if (helpers.hasRaw(self.input)) {
|
if (self.input.setRawMode) {
|
||||||
helpers.setRawMode(self.input, true);
|
self.input.setRawMode(true);
|
||||||
}
|
}
|
||||||
self.input.resume();
|
self.input.resume();
|
||||||
self.output.write = write;
|
self.output.write = write;
|
||||||
|
|
|
@ -1722,16 +1722,16 @@ Screen.prototype.spawn = function(file, args, options) {
|
||||||
var write = program.output.write;
|
var write = program.output.write;
|
||||||
program.output.write = function() {};
|
program.output.write = function() {};
|
||||||
program.input.pause();
|
program.input.pause();
|
||||||
if (helpers.hasRaw(program.input)) {
|
if (program.input.setRawMode) {
|
||||||
helpers.setRawMode(program.input, false);
|
program.input.setRawMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var resume = function() {
|
var resume = function() {
|
||||||
if (resume.done) return;
|
if (resume.done) return;
|
||||||
resume.done = true;
|
resume.done = true;
|
||||||
|
|
||||||
if (helpers.hasRaw(program.input)) {
|
if (program.input.setRawMode) {
|
||||||
helpers.setRawMode(program.input, true);
|
program.input.setRawMode(true);
|
||||||
}
|
}
|
||||||
program.input.resume();
|
program.input.resume();
|
||||||
program.output.write = write;
|
program.output.write = write;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"keywords": ["curses", "tui", "tput", "terminfo", "termcap"],
|
"keywords": ["curses", "tui", "tput", "terminfo", "termcap"],
|
||||||
"tags": ["curses", "tui", "tput", "terminfo", "termcap"],
|
"tags": ["curses", "tui", "tput", "terminfo", "termcap"],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6.0"
|
"node": ">= 0.8.0"
|
||||||
},
|
},
|
||||||
"browserify": {
|
"browserify": {
|
||||||
"transform": ["./browser/transform.js"]
|
"transform": ["./browser/transform.js"]
|
||||||
|
|
Loading…
Reference in New Issue