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

curses.textpad.Textbox backspace support #60436

Closed
emeaudroidemeaudroid mannequin opened this issue Oct 14, 2012 · 16 comments
Closed

curses.textpad.Textbox backspace support #60436

emeaudroidemeaudroid mannequin opened this issue Oct 14, 2012 · 16 comments
Labels
easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@emeaudroidemeaudroid
Copy link
Mannequin

emeaudroidemeaudroid mannequin commented Oct 14, 2012

BPO 16232
Nosy @ned-deily

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2012-10-14.14:38:05.797>
labels = ['extension-modules', 'easy', 'type-feature']
title = 'curses.textpad.Textbox backtrace support'
updated_at = <Date 2019-03-15.22:29:17.594>
user = 'https://bugs.python.org/emeaudroidemeaudroid'

bugs.python.org fields:

activity = <Date 2019-03-15.22:29:17.594>
actor = 'BreamoreBoy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Extension Modules']
creation = <Date 2012-10-14.14:38:05.797>
creator = 'emeaudroid.emeaudroid'
dependencies = []
files = []
hgrepos = []
issue_num = 16232
keywords = ['easy']
message_count = 3.0
messages = ['172888', '223108', '237423']
nosy_count = 3.0
nosy_names = ['ned.deily', 'emeaudroid.emeaudroid', 'ragreener']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue16232'
versions = ['Python 3.5']

Linked PRs

@emeaudroidemeaudroid
Copy link
Mannequin Author

emeaudroidemeaudroid mannequin commented 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 ?

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 ?

@emeaudroidemeaudroid emeaudroidemeaudroid mannequin added extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Oct 14, 2012
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented 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 ned-deily added the easy label Mar 7, 2015
@ned-deily
Copy link
Member

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@ProfDeSI
Copy link

ProfDeSI commented 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
Copy link

Also running this issue (Iterm2 on Mac)
Textbox backspace is not registering and can only delete using Ctrl + H

@aidanmelen
Copy link
Contributor

@k3lseytaylor I ran into the same issue. Maybe this example will help.

@mblahay
Copy link
Contributor

mblahay commented 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
Copy link
Contributor

aidanmelen commented Apr 24, 2023

@mblahay i think this issue is specific for macOS and python:3.11-alpine docker image.

@mblahay
Copy link
Contributor

mblahay commented Apr 24, 2023

@aidanmelen Do you see the issue when outside of docker?

@aidanmelen
Copy link
Contributor

aidanmelen commented Apr 24, 2023

@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.

@aidanmelen
Copy link
Contributor

I created a PR that fixes this issue.

@mblahay
Copy link
Contributor

mblahay commented Apr 24, 2023

@aidanmelen, I must be doing something different from you. What version of MacOS are you using?

@zitterbewegung
Copy link
Contributor

zitterbewegung commented 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
Copy link
Contributor

mblahay commented 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.

ambv added a commit that referenced this issue Apr 26, 2023
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Michael Blahay <mblahay@gmail.com>
@ambv ambv changed the title curses.textpad.Textbox backtrace support curses.textpad.Textbox backspace support Apr 26, 2023
@ambv
Copy link
Contributor

ambv commented Apr 26, 2023

Fixed in Python 3.12. Thanks Michael for reviving this, and thanks Aidan for the fix! ✨ 🍰 ✨

@ambv ambv closed this as completed Apr 26, 2023
@mblahay
Copy link
Contributor

mblahay commented Apr 26, 2023

Glad I was able to help coordinate this during Pycon US 2023 sprints. Sometimes things work better in person!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
Status: Done
Development

No branches or pull requests

7 participants