windows-curses icon indicating copy to clipboard operation
windows-curses copied to clipboard

For } and ] key presses, getch() always returns 0

Open nathan-gilbert opened this issue 3 years ago • 5 comments

I am working with Python 3.7 and on macOS/Linux the python curses library handles these keys correctly but on Windows using this library pressing either ] or Shift-] (to get }) the getch() method always returns 0. I've tried get_wchr and get_str as well to the same effect.

nathan-gilbert avatar Jan 18 '23 23:01 nathan-gilbert

I have the same effect with Python 3.10 under Windows 10. Furthermore, pressing (') - apostrophe key - always returns int 530.

ibondar-altilan avatar Feb 03 '23 12:02 ibondar-altilan

I'm also experiencing this issue. The windows-curses project depends on PDCurses. That means that the solution should be contributed to that project as well. Simply updating to a newer version of PDCurses will not offer a solution I think, since I looked at the diff and not a lot has changed.

My best guess would be to start looking around here: https://github.com/zephyrproject-rtos/PDCurses/blob/2e15c90f122fef329b83a4c3c011f192d97ec516/wincon/pdckbd.c

Probably somewhere next week I could look into this, submit a PR to PDCurses, and bump the submodule here as well. If anyone else has time before that, feel free to get started of course.

bartbroere avatar Apr 05 '23 20:04 bartbroere

this seems to have regressed between windows-curses 2.3.0 and 2.3.1 -- an easy reproduction is by trying to type either a ' or } in my text editor as reported here: https://github.com/asottile/babi/issues/295#issuecomment-1537214493

asottile avatar May 06 '23 20:05 asottile

Thanks @asottile. This information helped me fix this in visidata.

bartbroere avatar May 15 '23 07:05 bartbroere

pip install windows-curses==2.3.0

Resolved this problem for me - however, wheels for that version are only available for Python 3.10 and lower; that might be an issue for some folks.

See https://github.com/saulpw/visidata/issues/2119#issuecomment-1818084707 for some troubleshooting about this, including encoding/locale settings.

isosphere avatar Nov 20 '23 02:11 isosphere

Fixed by v2.4.0. Please comment if this issue persists.

stephanosio avatar Oct 14 '24 14:10 stephanosio