]> granicus.if.org Git - python/commitdiff
Rework previous fix slightly; the &0x20 test seems useless, and the isprint() check...
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 29 Aug 2003 18:50:59 +0000 (18:50 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 29 Aug 2003 18:50:59 +0000 (18:50 +0000)
Lib/curses/ascii.py

index 08b5b79f5fd48f05c81dd80444ee567c33454e8d..800fd8b4b71fad4e0fa361bc73dc07e57494f06c 100644 (file)
@@ -87,13 +87,11 @@ def alt(c):
         return _ctoi(c) | 0x80
 
 def unctrl(c):
-    if isprint(c):
-        return chr(_ctoi(c))
     bits = _ctoi(c)
     if bits == 0x7f:
         rep = "^?"
-    elif bits & 0x20:
-        rep = chr((bits & 0x7f) | 0x20)
+    elif isprint(bits & 0x7f):
+        rep = chr(bits & 0x7f)
     else:
         rep = "^" + chr(((bits & 0x7f) | 0x20) + 0x20)
     if bits & 0x80: