magmax/python-inquirer

Output gets corrupted if content cannot fit the terminal

maciejmatczak opened this issue · 4 comments

Hi there! First - thanks for that library.

To the business though. With that example:

import inquirer


if __name__ == "__main__":
    choices = [
        ('1 asdfsadf asdf asdf asf as fdaf asf as fasf asf', '1'),
        ('jljl jl jkl;kjl;jk l;jk ;lj ;ljkl;kj l;j kl;jl;jl jl; ', '2'),
        ('reqwerqew r qwer qwerwqr qwr eqwr werqrqwer w qer qr ', '3'),
    ]

    answers = inquirer.list_input(choices)

    print(answers)

... when the terminal is shorter than the the content, the output gets corrupted:

Header not fitting:

image

Header and choices not fitting:

image

It seems like the choices can be nicely wrapped and doesn't get corrupted. So it might be a header problem only. Checked that on unix bash, tcsh and on windows with their new terminal...

Duplicate of #26

I've got this problem too...

Can confirm this still happens, I can fix it by shortening the strings to the size of the terminal and putting ... after it, but this really only works for certain usage of this package, and in most usage, this wouldn't be a great solution because this is meant for prompts, whereas I'm using it for a selector.

Hi there,

Just wanted to chime in that I'm also seeing the same with the Checkbox question type. With a very quick read of the code, I guess it's the ConsoleRenderer that causes this.

Whenever I move from one line to the other with the cursor, the question (and/or other lines) get repeated above the list.

Duplicate of #26