Skip to content

Commit

Permalink
Fix cursor position in clearStream function
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcarpanelli committed May 21, 2019
1 parent 6b1a6ee commit a3c9b5a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ class Spinners {
this.checkIfActiveSpinners();
}

setStream(frame) {
setStream(frame = '') {
let line;
let stream = '';
const rawLines = [];
Object.values(this.spinners).map(({ text, status, color, spinnerColor, successColor, failColor }) => {
text = breakText(text);
rawLines.push(...(text.split('\n').map(line => line.length)));
rawLines.push(...(text.split('\n').map(line => line.length + frame.length)));
if (status === 'spinning') {
line = `${chalk[spinnerColor](frame)} ${chalk[color](text)}`;
} else if (status === 'success') {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodejs-terminal-multispinner",
"version": "0.1.1",
"version": "0.1.2",
"description": "Multiple spinners for the terminal",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a3c9b5a

Please sign in to comment.