Skip to content

Commit

Permalink
try another way to clear previous line on non TTY
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <[email protected]>
  • Loading branch information
Charlike Mike Reagent committed Mar 3, 2018
1 parent 9cb058b commit daf27a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/elements/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const readline = require('readline');
const { action } = require('../util');
const EventEmitter = require('events');
const { beep, cursor } = require('sisteransi');
const { beep, cursor, erase } = require('sisteransi');

/**
* Base prompt skeleton
Expand Down Expand Up @@ -39,7 +39,8 @@ class Prompt extends EventEmitter {
if (this.in.isTTY) {
this.in.setRawMode(false);
} else {
this.clear()
// we can't use `utils.clear()`, because it expect `prompt` string
this.out.write(erase.line + cursor.prevLine());
}
rl.close();
this.emit(this.aborted ? 'abort' : 'submit', this.value);
Expand Down

0 comments on commit daf27a3

Please sign in to comment.