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

First line stay in console #13

Open
dimdimbe opened this issue Feb 15, 2017 · 7 comments
Open

First line stay in console #13

dimdimbe opened this issue Feb 15, 2017 · 7 comments

Comments

@dimdimbe
Copy link

dimdimbe commented Feb 15, 2017

Hi,

The first line stay in the console when i do
log(logStr.join('\n')) //logStr is a array of string

capture d ecran 2017-02-15 a 22 31 49

Am i doing something wrong?
Is there someone experiencing the same "bug" ?

Thank you in advance

@freeall
Copy link
Owner

freeall commented Feb 15, 2017

I'm not sure I understand the screenshot. Can you make a simpler case and see if it works?

@dimdimbe
Copy link
Author

I will try to make a simpler case.

In the mean time i made a video screenshot maybe it's clearer

@dimdimbe
Copy link
Author

I think it's because i play with "stdin"
I have the same issue with the following code

const log = require('single-line-log').stdout

process.stdin.on('data',(chunk) => {
  log.clear()
  log('i just type: '+chunk.toString())
})

@freeall
Copy link
Owner

freeall commented Feb 15, 2017

Ahh, yeah, that is probably not a good idea to mix with single-line-log :)

@dimdimbe
Copy link
Author

dimdimbe commented Feb 15, 2017

i just try changing line 28 in the index.js file of the module

str += MOVE_LEFT + CLEAR_LINE + (i < prevLineCount-1 ? MOVE_UP : '');

by removing the "-1"

str += MOVE_LEFT + CLEAR_LINE + (i < prevLineCount ? MOVE_UP : '');

It fix my problem, and when i run the test.js file, everything look fine as well

Can i propose this as a PR ? or the "-1" has a purpose

@freeall
Copy link
Owner

freeall commented Feb 15, 2017

I'm almost in my bed, but it'd be nice if you do a PR, then I'll take a look tomorrow

@dimdimbe
Copy link
Author

Same for me ;)
I'll do a PR (at least try , i'm quite new to open source stuff)

Thank's for your time and for the module :D

dimdimbe added a commit to dimdimbe/single-line-log that referenced this issue Feb 15, 2017
As explain in this issue freeall#13
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

2 participants