Escape key handling fix

Ben Ford pointed out that the escape key can cause things to go a little
awry, I've fixed that and added another fix for potential breakage that
hadn't come up before.
This commit is contained in:
Bob Farrell
2008-06-16 22:09:23 +01:00
parent 596a76e86f
commit 85d6485565
2 changed files with 12 additions and 1 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# bpython 0.4.0::fancy curses interface to the Python repl::Bob Farrell 2008
# bpython 0.4.2::fancy curses interface to the Python repl::Bob Farrell 2008
#
# The MIT License
#
@@ -819,6 +819,9 @@ class Repl:
y, x = self.scr.getyx()
if not self.s:
return
if x == self.ix and y == self.iy:
return
@@ -864,6 +867,8 @@ class Repl:
self.clrtobol()
self.c = '\n'
# Don't return; let it get handled
if self.c == chr( 27 ):
return ''
if self.c in ( chr(127), 'KEY_BACKSPACE' ):
self.bs()