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

Cursor being repositioned incorrectly #4

Closed
jameshibbard opened this issue Jun 29, 2016 · 3 comments
Closed

Cursor being repositioned incorrectly #4

jameshibbard opened this issue Jun 29, 2016 · 3 comments

Comments

@jameshibbard
Copy link

Module isn't working for me on bash on Linux Mint.

bash --version
$ GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)

I did:

npm install clear
node
var clear = require("clear");
clear();

I see:

image

Notice the weird character before undefined?

I think this has something to do with the character sequence you are using to reset the cursor position:

In clear/index.js line 5 we have:

process.stdout.write('\033[0f');

According to this page:

Position the Cursor: \033[;H Or \033[;f puts the cursor at line L and column C.

And sure enough, changing it to:

process.stdout.write('\033[0;0f');

Makes things work as expected:

image

@lequer
Copy link

lequer commented Nov 25, 2016

Same on Ubuntu 16.04, bash version 4.3.46
process.stdout.write('\033[0;0f');
work as expected.

@bahamas10
Copy link
Owner

Thanks for the detailed report - sorry I didn't see this sooner. I just published [email protected] now. I don't have an Ubuntu machine to test on but if you could test again that would be much appreciated. If it still fails I can look into modifying it to use the sequence you pasted above.

@jameshibbard
Copy link
Author

jameshibbard commented Feb 27, 2018

Hi, I can confirm that this works on the latest version of Linux Mint (18.3). Thanks for the fix.

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

3 participants