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

List options wont clear from screen after selected. #57

Open
sdushantha opened this issue Dec 13, 2018 · 3 comments
Open

List options wont clear from screen after selected. #57

sdushantha opened this issue Dec 13, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@sdushantha
Copy link

I am trying to prompt the user for multiple questions using inquirer.List. I am able to select the items but the options wont clear away when asking for the next one.

>>> inquirer.prompt(questions);inquirer.prompt(questions)                        
[?] What size do you need?: Large
   Jumbo
 > Large
   Standard
   Medium
   Small
   Micro

[?] What size do you need?: Medium
   Jumbo
   Large
   Standard
 > Medium
   Small
   Micro

Is it possible to clear the options like inquirer.js does?

@AuHau
Copy link
Collaborator

AuHau commented Mar 5, 2019

I am afraid there is no support for this feature at this moment.

@AuHau AuHau added the enhancement New feature or request label Mar 5, 2019
@mauricesvp
Copy link

This can achieved by adding

print(self.terminal.home + self.terminal.clear, end="")

before this, however this could come with potential side effects.

@NaleRaphael
Copy link

Thanks for this awesome package! I was running into this problem yesterday, and I've customize a component to solve it after digging into source code.
You can check it out here: https://gist.github.com/NaleRaphael/64acf6404aeab749ae335a457d842c95

The idea of this implementation is that we have to know have many lines have been printed, and then we can move the cursor to that line and clear those lines under it. (with the help of blessed.Terminal().move_up() and blessed.Terminal().clear_eol())

And also thanks for the advice from @mauricesvp. But since it will clear the whole history (printed lines) in current terminal, I have to give up on it.

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

No branches or pull requests

4 participants