aisk / pick

create curses based interactive selection list in the terminal
MIT License
721 stars 60 forks source link

Add option to pass in existing screen. #92

Closed snail-coupe closed 1 year ago

snail-coupe commented 1 year ago

I believe this fixes issue #91

adds optional stdscr parameter to pick() and if set takes a modified code path that skips normal initialisation but instead just hides (and unhides) the cursor.

This works for my test harness and running pytest still passes (as it should as won't touch this code path).

I've not caught the case where the user passes a bad paramter, or they haven't enabled things like cbreak.

wong2 commented 1 year ago

Some tests failed @snail-coupe

snail-coupe commented 1 year ago

Ugh - I guess maybe something changed with 3.8?

As far as I can tell there is no good type I can use this, other than relying on possibly undocumented or changing internal types.

Would it be acceptable if I just reverted:

https://github.com/wong2/pick/pull/92/commits/0bcd39b0b75ad928298b5d8755e97ffaaf08cb7e

and went back to using Any

wong2 commented 1 year ago

I'll try to figure that out

wong2 commented 1 year ago

Merged in commit https://github.com/wong2/pick/commit/14963d67d17da648fdd61a9b438c56149d11c0cf

wong2 commented 1 year ago

Thanks for your contribution!

wong2 commented 1 year ago

v2.2.0 released

snail-coupe commented 1 year ago

Thank you too. I know it was only a small change and you ended up doing some typing stuff anyway, but it always feels good to try and contribute back.