Skip to content

Commit

Permalink
fix(deck): Fix issue with check if cursor is not a tty stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiklor committed May 4, 2016
1 parent 313e7eb commit f29ca07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Deck.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import keypress from 'keypress';
import Cursor from 'kittik-cursor';
import Slide from './Slide';
import tty from 'tty';

/**
* Deck class is responsible for managing slides and their rendering.
Expand Down Expand Up @@ -60,12 +61,12 @@ export default class Deck {
}

/**
* Init keyboard and bind EventEmitter to the stdin stream.
* Init keyboard and binds EventEmitter to the stdin stream.
*
* @private
*/
_initKeyboard() {
if (this._cursor._stream === process.stdin) {
if (tty.isatty(this._cursor._stream)) {
keypress(process.stdin);
process.stdin.setRawMode(true);
process.stdin.setEncoding('utf8');
Expand Down Expand Up @@ -109,7 +110,6 @@ export default class Deck {
renderSlide(index = this._currentSlideIndex) {
if (!this._slides[index]) return this;

this._cursor.eraseScreen();
this._slides[index].render();

return this;
Expand Down

0 comments on commit f29ca07

Please sign in to comment.