You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
could you replace the backspace's specific chars codes by using this dedicated curses' function retrieving the currently in-use char's code ?
ord( curses.erasechar( ))
this one would make specific erase char specified to term supported, unlike curses.ascii.BS, curses.KEY_BACKSPACE that are specifics to most configurations indeed.
at least adding the curses.ascii.DEL char's code seems legit na ?
@emeaudroid please accept our apologies for the delay in getting back to you. Can someone take a look at this please as I don't have a *nix box to play with.
This has also been reported in bpo-23598 including a patch to add DEL as suggested. I have little experience with curses so I don't have any insight as to pros and cons of using erasechar() rather than the hardcoded BS and DEL chars. A test would be nice if someone has a creative approach for creating one. I see that a patch for bpo-13051 contains a suggested test for another problem with curses.textpad; perhaps it could be adapted.
Hello there, I am digging up this discussion because I am starting to use curses and I can't erase the text I type inside a Textbox (I use Thonny on a Mac) and it seems that I have stumbled upon a deep rooted issue. Since the previous message is seven years old, am I right if I say that this bug was forgotten and never fixed ?
@aidanmelen Do you see the issue when outside of docker?
It does not work in either of those environments. It only works on Mac when we handle curses.ascii.DEL key presses in addition to curses.KEY_BACKSPACE.
I helped @mblahay reproduce this on an M1 Mac using macOS 13.3.1 and in a terminal using ncurses and delete was working fine . In textedit delete and backspace is working.
@aidanmelen We were finally able to reproduce this issue. Our problem with reproduction stemmed from our using the wrong example. When we use the example in your pull request, we also see the issue on macs (verified on three different machines). For those that are following along, the problem can be seen when running the Lib/curses/textpad.py module file as a script. It should produce a square that you can type into (and delete from!). The fix you provided does appear to work, and as far as we can tell does not cause any negative affects on Linux/Windows.
Activity
emeaudroidemeaudroid commentedon Oct 14, 2012
python: 2.6.6
curses' revision: 61064 2008-02-25 16:29:58Z andrew.kuchling
line 93 and 102 of curses/textpad.py
could you replace the backspace's specific chars codes by using this dedicated curses' function retrieving the currently in-use char's code ?
this one would make specific erase char specified to term supported, unlike curses.ascii.BS, curses.KEY_BACKSPACE that are specifics to most configurations indeed.
at least adding the curses.ascii.DEL char's code seems legit na ?
BreamoreBoy commentedon Jul 15, 2014
@emeaudroid please accept our apologies for the delay in getting back to you. Can someone take a look at this please as I don't have a *nix box to play with.
ned-deily commentedon Mar 7, 2015
This has also been reported in bpo-23598 including a patch to add DEL as suggested. I have little experience with curses so I don't have any insight as to pros and cons of using erasechar() rather than the hardcoded BS and DEL chars. A test would be nice if someone has a creative approach for creating one. I see that a patch for bpo-13051 contains a suggested test for another problem with curses.textpad; perhaps it could be adapted.
ProfDeSI commentedon Nov 4, 2022
Hello there, I am digging up this discussion because I am starting to use curses and I can't erase the text I type inside a
Textbox(I use Thonny on a Mac) and it seems that I have stumbled upon a deep rooted issue. Since the previous message is seven years old, am I right if I say that this bug was forgotten and never fixed ?k3lseytaylor commentedon Dec 30, 2022
Also running this issue (Iterm2 on Mac)
Textbox backspace is not registering and can only delete using Ctrl + H
aidanmelen commentedon Apr 6, 2023
@k3lseytaylor I ran into the same issue. Maybe this example will help.
mblahay commentedon Apr 24, 2023
@ProfDeSI @k3lseytaylor @aidanmelen
I am attempting to reproduce this issue, but not having any success. Please confirm which version of Python you are using.
aidanmelen commentedon Apr 24, 2023
@mblahay i think this issue is specific for macOS and
python:3.11-alpinedocker image.mblahay commentedon Apr 24, 2023
@aidanmelen Do you see the issue when outside of docker?
aidanmelen commentedon Apr 24, 2023
It does not work in either of those environments. It only works on Mac when we handle
curses.ascii.DELkey presses in addition tocurses.KEY_BACKSPACE.aidanmelen commentedon Apr 24, 2023
I created a PR that fixes this issue.
mblahay commentedon Apr 24, 2023
@aidanmelen, I must be doing something different from you. What version of MacOS are you using?
zitterbewegung commentedon Apr 24, 2023
I helped @mblahay reproduce this on an M1 Mac using macOS 13.3.1 and in a terminal using ncurses and delete was working fine . In textedit delete and backspace is working.
mblahay commentedon Apr 25, 2023
@aidanmelen We were finally able to reproduce this issue. Our problem with reproduction stemmed from our using the wrong example. When we use the example in your pull request, we also see the issue on macs (verified on three different machines). For those that are following along, the problem can be seen when running the Lib/curses/textpad.py module file as a script. It should produce a square that you can type into (and delete from!). The fix you provided does appear to work, and as far as we can tell does not cause any negative affects on Linux/Windows.
gh-60436: fix curses textbox backspace/del (#103783)
[-]curses.textpad.Textbox backtrace support[/-][+]curses.textpad.Textbox backspace support[/+]ambv commentedon Apr 26, 2023
Fixed in Python 3.12. Thanks Michael for reviving this, and thanks Aidan for the fix! ✨ 🍰 ✨
mblahay commentedon Apr 26, 2023
Glad I was able to help coordinate this during Pycon US 2023 sprints. Sometimes things work better in person!