Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all lines are cleared, when the number of lines exceeds console height #121

Open
ngocdaothanh opened this issue Aug 17, 2019 · 1 comment

Comments

@ngocdaothanh
Copy link

Example program:

const ora = require('ora');

let count = 1;

const spinner = ora(`Line ${count}`);

spinner.start();

setInterval(() => {
  count++;
  spinner.text += `\nLine ${count}`;
}, 50);

setTimeout(() => {
  spinner.succeed();
  process.exit();
}, 1000);

Resize console window to have only 8 lines (I'm using the default Terminal on Mac).

The last 8 lines seem good:

Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
mycomputer $ 

But when you scroll up to see all lines, they look like this:

mycomputer $ node index.js 
⠦ Line 1
Line 2
⠧ Line 1
Line 2
Line 3
⠇ Line 1
Line 2
Line 3
Line 4
Line 5
⠏ Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
⠋ Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
⠙ Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
⠹ Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
✔ Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
mycomputer $ 
@ngocdaothanh
Copy link
Author

ora spinner works by removing previously rendered lines at every frame.
When the number of lines exceed the console height,
ora cannot remove lines above the console top line.
When users scroll up the console, they will see garbage lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant