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

Multiselect spams the terminal #89

Closed
jamen opened this issue Sep 12, 2018 · 9 comments
Closed

Multiselect spams the terminal #89

jamen opened this issue Sep 12, 2018 · 9 comments

Comments

@jamen
Copy link

jamen commented Sep 12, 2018

Great module! I use this often for small scripts.

I've had an issue with the multiselect, where moving the selection causes it to improperly replace the last lines, and your terminal gets spammed.

screencast

Edit: I should add I'm using Alacritty terminal.

@elie-g
Copy link
Contributor

elie-g commented Sep 13, 2018

I'm not sure but I checked it and I think it's an issue of Alacritty. Alacritty does not seem to listen correctly to ANSI escape sequences.

@terkelg
Copy link
Owner

terkelg commented Sep 13, 2018

Hi @jamen! Does this happen for you in other terminals?
@DrunkenPoney do you have experience with Alacritty, what's a possible solution?

@elie-g
Copy link
Contributor

elie-g commented Sep 13, 2018

@terkelg
I downloaded Alacritty expressly for this issue.
I don't know what could be a possible solution, I tried to replace the sistersansi variables with the corresponding ANSI escape sequences following their ANSI documentation but it still doesnt work. After playing a little bit with the escape sequences I figured out that it seems to be the vertical cursor movement sequences which are not working so it only erase the current line. I have to go now but I'll try to find another solution tomorrow.

@elie-g
Copy link
Contributor

elie-g commented Sep 13, 2018

I made another test and now I'm pretty sure it's an issue with alacritty itself.
Here is the test I made:

const w = str => process.stdout.write(str);

w(`This is the first line\n`);
w(`This is the second line\n`);
w(`And this is the third line`);

// Move cursor one line upward
w(`\u001b[1F`); // CPL

// Move cursor to the 12th column (after `the`)
w('\u001b[12G'); // CHA

// Erase to end of screen
w('\u001b[J'); // ED

/* EXPECTED RESULT:
This is the first line
This is the
 */

/* ACTUAL RESULT (with Alacritty):
This is the first line
This is the second line
And this is
 */

// Cursor does not move upward

I also ran this in a normal terminal just to be sure and it gave me the expected result.

I'll create an issue on Alacritty repo.

@elie-g
Copy link
Contributor

elie-g commented Sep 13, 2018

I tried the same script with the CUU escape sequence (ESC[A) and it seems to work.
I will fix this in sisteransi.

@jamen
Copy link
Author

jamen commented Sep 13, 2018

@terkelg @DrunkenPoney I did not see this on other terminals. I figured it had something to do with Alacritty but didn't know where to open the issue.

I tried the changes with my test and it works! But is this more of an Alacritty issue and prompts is more proper without the changes? Either way thanks for investigating it.

My test, for posterity

@terkelg
Copy link
Owner

terkelg commented Sep 13, 2018

I would prefer to keep it simple and not add too much terminal-specific code. It seems like Alacritty is aware of it and working on implementing it. What do you guys think?

@elie-g
Copy link
Contributor

elie-g commented Sep 13, 2018

@terkelg I think you're right. It's not a Prompts issue but an Alacritty issue. In my opinion it would be preferable to not merge my pull request since it replaces a sequence defined by the ANSI standards. It's Alacritty which doesn't implement all ANSI sequences yet.

@jamen
Copy link
Author

jamen commented Sep 14, 2018

Agreed

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