bpo-32068: curses.textpad isn't handling the backspace key on some systems
On some systems, ascii.DEL (127) is sent on the backspace key event.
This commit is contained in:
parent
c4d45ee670
commit
705e35e5fd
|
@ -102,7 +102,8 @@ class Textbox:
|
|||
self._insert_printable_char(ch)
|
||||
elif ch == curses.ascii.SOH: # ^a
|
||||
self.win.move(y, 0)
|
||||
elif ch in (curses.ascii.STX,curses.KEY_LEFT, curses.ascii.BS,curses.KEY_BACKSPACE):
|
||||
elif ch in (curses.ascii.STX, curses.KEY_LEFT, curses.ascii.BS,
|
||||
curses.KEY_BACKSPACE, curses.ascii.DEL):
|
||||
if x > 0:
|
||||
self.win.move(y, x-1)
|
||||
elif y == 0:
|
||||
|
@ -111,7 +112,7 @@ class Textbox:
|
|||
self.win.move(y-1, self._end_of_line(y-1))
|
||||
else:
|
||||
self.win.move(y-1, self.maxx)
|
||||
if ch in (curses.ascii.BS, curses.KEY_BACKSPACE):
|
||||
if ch in (curses.ascii.BS, curses.KEY_BACKSPACE, curses.ascii.DEL):
|
||||
self.win.delch()
|
||||
elif ch == curses.ascii.EOT: # ^d
|
||||
self.win.delch()
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
The :mod:`curses.textpad` module can now handle systems that send
|
||||
``ascii.DEL`` (``127``) on the backspace key event.
|
Loading…
Reference in New Issue