IngoMeyer441 / simple-term-menu

A Python package which creates simple interactive menus on the command line.
MIT License
492 stars 43 forks source link

Holding the key-`down` causes TerminalMenu.show returns None on `rlwrap` #77

Open minghu6 opened 1 year ago

minghu6 commented 1 year ago

Env: Ubuntu 22.04, Python 3.10, Gnome Shell

Pressing down too quickly causes show returns None unexpectly (especially for the long menu).

And as a workaround, If I put the show method into a infinite loop, it also protects from quit shortcuts. (need a specific exception to indicate a quit event?)

IngoMeyer441 commented 1 year ago

Thanks for the bug report. I tried to quickly press cursor down on a long list with 100 entries, but could not get your described behavior (on Ubuntu 22.04 with gnome terminal). Do you also use the default gnome terminal?

minghu6 commented 1 year ago

Thanks for the bug report. I tried to quickly press cursor down on a long list with 100 entries, but could not get your described behavior (on Ubuntu 22.04 with gnome terminal). Do you also use the default gnome terminal?

Yes, i use default gnome shell (v42.5), sometimes it's ok, however if i rerun the script the issue occurs (just holding the key).

minghu6 commented 1 year ago

Thanks for the bug report. I tried to quickly press cursor down on a long list with 100 entries, but could not get your described behavior (on Ubuntu 22.04 with gnome terminal). Do you also use the default gnome terminal?

Oh. I found the detail !, I run the script use an alias which is rlwrap python, that's if I run python in rlwrap (0.43-1build3 from ubuntu official repo) and then the issue occurs!

IngoMeyer441 commented 1 year ago

Python already has built-in edit support with libreadline. Do you really need rlwrap here?

minghu6 commented 1 year ago

Python already has built-in edit support with libreadline. Do you really need rlwrap here?

It looks like i could use import readline to replace rlwrap.

IngoMeyer441 commented 1 year ago

With rlwrap simple-term-menu $(seq 1 100) I can reproduce the behavior, you described. But I am not really sure if this is an issue with simple-term-menu or with rlwrap.

minghu6 commented 1 year ago

With rlwrap simple-term-menu $(seq 1 100) I can reproduce the behavior, you described. But I am not really sure if this is an issue with simple-term-menu or with rlwrap.

I've tried another terminal menu on a Rust impl with rlwrap, and it's alright. Maybe there are some incompatiable on terminal manipulation or comflict on libreadline?