Style 00 bytes as comments in MemoryView

This makes it easier to notice and pay attention to nonzero bytes in
memory that's mostly zeroes.
This commit is contained in:
Brian Chen 2017-11-05 19:50:05 -05:00
parent cd141b56dd
commit 0d4f3d3296
1 changed files with 4 additions and 6 deletions

View File

@ -90,13 +90,11 @@ class MemoryView(TerminalView):
byte_array = []
for i, x in enumerate(six.iterbytes(chunk)):
n = "%02X" % x
token = Text if x else Comment
if self.args.track and self.last_memory and self.last_address == m_res.address:
if x != six.indexbytes(self.last_memory, c + i):
byte_array.append((Error, n))
else:
byte_array.append((Text, n))
else:
byte_array.append((Text, n))
token = Error
byte_array.append((token, n))
if self.args.words:
if target['byte_order'] =='little':
@ -112,7 +110,7 @@ class MemoryView(TerminalView):
# ASCII representation
yield (Punctuation, '| ')
for i, x in enumerate(six.iterbytes(chunk)):
token = String.Char
token = String.Char if x else Comment
if self.args.track and self.last_memory and self.last_address == m_res.address:
if x != six.indexbytes(self.last_memory, c + i):
token = Error