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

Using pick.pick within curses.wrapper() breaks input #91

Closed
snail-coupe opened this issue Nov 19, 2022 · 7 comments
Closed

Using pick.pick within curses.wrapper() breaks input #91

snail-coupe opened this issue Nov 19, 2022 · 7 comments

Comments

@snail-coupe
Copy link
Contributor

test_pick.txt

I'm trying to use pick to add a menu to an existing application, however after doing so the application fails to detect input correctly.

In the attached example I get and print a key press, run a pick menu, then attempt to get and print another key press. However rather than the second keypress be read it ends up being echoed to the terminal.

pick.issue.mp4

This using Python 3.9 running in a WSL Debian Bullseye

$ pip list | grep pick
pick              2.1.0
$ python -V
Python 3.9.2
$ uname -a
Linux Potoroo 5.15.68.1-microsoft-standard-WSL2 #1 SMP Mon Sep 19 19:14:52 UTC 2022 x86_64 GNU/Linux
$ head -1 /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
@snail-coupe
Copy link
Contributor Author

I don't know if this relates to / is same as #83

@snail-coupe
Copy link
Contributor Author

For completeness, I also tested on my raspberry pi and it was reproducible:

$ pip list | grep pick
pick        2.1.0
$ python -V
Python 3.10.7
$ uname -a
Linux possum 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux
$ cat /etc/debian_version
11.5

@wong2
Copy link
Collaborator

wong2 commented Nov 20, 2022

Thanks for your report, I believe the problem is you're creating nested curses screens: pick itself is also running inside a curses.wrapper call.

@wong2
Copy link
Collaborator

wong2 commented Nov 20, 2022

Perhaps pick can accept an optional screen parameter, if provided, use it instead of creating a new curses screen.

@snail-coupe
Copy link
Contributor Author

That would make sense as it'd mean pick had done all the teardown type operations.

(and I've seen similar with a different menu module too)

I'd be happy to create a fork and give that a try (and make a PR if it works) if you'd like

@wong2
Copy link
Collaborator

wong2 commented Nov 20, 2022

Sure! Go ahead

snail-coupe added a commit to snail-coupe/pick that referenced this issue Nov 20, 2022
@snail-coupe
Copy link
Contributor Author

That seems to fix it, at least in my limited use case (and shouldn't break your existing code path)

@wong2 wong2 closed this as completed in 14963d6 Nov 21, 2022
anafvana referenced this issue in anafvana/groupick Dec 24, 2022
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

2 participants