HexEdit/HexEditWidget.py

changeset 4663
e2625053a0e2
parent 4659
2863d05e83c6
child 4664
a40706f44514
diff -r 33e6bd4b1721 -r e2625053a0e2 HexEdit/HexEditWidget.py
--- a/HexEdit/HexEditWidget.py	Sat Jan 16 14:02:49 2016 +0100
+++ b/HexEdit/HexEditWidget.py	Sat Jan 16 15:16:24 2016 +0100
@@ -9,6 +9,9 @@
 
 from __future__ import unicode_literals
 
+import sys
+is_Py2 = sys.version_info[0] == 2
+
 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QTimer, QRect, \
     QBuffer, QIODevice
 from PyQt5.QtGui import QBrush, QPen, QColor, QFont, QPalette, QKeySequence, \
@@ -21,9 +24,6 @@
 import Globals
 
 
-# TODO: implement editing in ASCII area
-
-
 class HexEditWidget(QAbstractScrollArea):
     """
     Class implementing an editor for binary data.
@@ -1422,7 +1422,10 @@
                     # render ascii value
                     if self.__asciiArea:
                         by = self.__dataShown[bPosLine + colIdx]
-                        if by < 0x20 or by > 0x7e:
+                        if is_Py2 and (by < 0x20 or by > 0x7e):
+                            ch = "."
+                        elif not is_Py2 and \
+                                (by < 0x20 or (by > 0x7e and by < 0xa0)):
                             ch = "."
                         else:
                             ch = chr(by)

eric ide

mercurial