mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 23:50:18 +00:00
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:
+3
-2
@@ -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 )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user