diff --git a/lib/program.js b/lib/program.js index af800f4..3a657c2 100644 --- a/lib/program.js +++ b/lib/program.js @@ -16,7 +16,6 @@ var EventEmitter = require('events').EventEmitter var Tput = require('./tput') , colors = require('./colors') - , helpers = require('./helpers') , slice = Array.prototype.slice; var nextTick = global.setImmediate || process.nextTick.bind(process); @@ -325,8 +324,8 @@ Program.prototype.listen = function() { this.on('newListener', this._newHandler = function fn(type) { if (type === 'keypress' || type === 'mouse') { self.removeListener('newListener', fn); - if (helpers.hasRaw(self.input) && !helpers.isRaw(self.input)) { - helpers.setRawMode(self.input, true); + if (self.input.setRawMode && !self.input.isRaw) { + self.input.setRawMode(true); self.input.resume(); } } @@ -402,7 +401,7 @@ Program.prototype._listenInput = function() { Program.prototype._listenOutput = function() { var self = this; - if (!helpers.isTTY(this.output)) { + if (!this.output.isTTY) { nextTick(function() { self.emit('warning', 'Output is not a TTY'); }); @@ -464,9 +463,9 @@ Program.prototype.destroy = function() { delete this.input._keypressHandler; delete this.input._dataHandler; - if (helpers.hasRaw(this.input)) { - if (helpers.isRaw(this.input)) { - helpers.setRawMode(this.input, false); + if (this.input.setRawMode) { + if (this.input.isRaw) { + this.input.setRawMode(false); } if (!this.input.destroyed) { this.input.pause(); @@ -4178,16 +4177,16 @@ Program.prototype.pause = function(callback) { var write = this.output.write; this.output.write = function() {}; - if (helpers.hasRaw(this.input)) { - helpers.setRawMode(this.input, false); + if (this.input.setRawMode) { + this.input.setRawMode(false); } this.input.pause(); return this._resume = function() { delete self._resume; - if (helpers.hasRaw(self.input)) { - helpers.setRawMode(self.input, true); + if (self.input.setRawMode) { + self.input.setRawMode(true); } self.input.resume(); self.output.write = write; diff --git a/lib/widgets/screen.js b/lib/widgets/screen.js index 45a570f..03c1814 100644 --- a/lib/widgets/screen.js +++ b/lib/widgets/screen.js @@ -1722,16 +1722,16 @@ Screen.prototype.spawn = function(file, args, options) { var write = program.output.write; program.output.write = function() {}; program.input.pause(); - if (helpers.hasRaw(program.input)) { - helpers.setRawMode(program.input, false); + if (program.input.setRawMode) { + program.input.setRawMode(false); } var resume = function() { if (resume.done) return; resume.done = true; - if (helpers.hasRaw(program.input)) { - helpers.setRawMode(program.input, true); + if (program.input.setRawMode) { + program.input.setRawMode(true); } program.input.resume(); program.output.write = write; diff --git a/package.json b/package.json index ef3b3d4..497c0fb 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "keywords": ["curses", "tui", "tput", "terminfo", "termcap"], "tags": ["curses", "tui", "tput", "terminfo", "termcap"], "engines": { - "node": ">= 0.6.0" + "node": ">= 0.8.0" }, "browserify": { "transform": ["./browser/transform.js"]