Unprintable character handling fix

Things like C-p and C-n and all that were just being echoed as ^P, and
only one character was being put into the buffer, whereas two were being
echoed. Now only printable characters are accepted for regular input.
This commit is contained in:
Bob Farrell
2008-06-18 23:36:10 +01:00
parent a497cca157
commit 414b8a3daf
+3 -2
View File
@@ -41,6 +41,7 @@ import signal
import struct
import termios
import fcntl
import string
import ConfigParser
from bpython.formatter import BPythonFormatter
@@ -810,7 +811,7 @@ class Repl( object ):
s = s.replace( '\x03', '' )
s = s.replace( '\x01', '' )
self.scr.addstr( s, a )
if redraw and not self.evaluating:
@@ -953,7 +954,7 @@ class Repl( object ):
elif self.c == '\t':
return self.tab()
elif len( self.c ) == 1 and ord( self.c ) <= 127:
elif len( self.c ) == 1 and self.c in string.printable:#ord( self.c ) <= 127:
self.addc( self.c )
self.print_line( self.s )