--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-04-10 15:48:07 +00:00
parent 5c0beaf55b
commit 8f75c44bc1
2 changed files with 12 additions and 7 deletions

View File

@ -523,15 +523,19 @@ class Binary32Buffer(FileBuffer):
def __init__(self, path, nl='\n', name=None): def __init__(self, path, nl='\n', name=None):
'''fb = FileBuffer(path)''' '''fb = FileBuffer(path)'''
FileBuffer.__init__(self, path, nl, name) FileBuffer.__init__(self, path, nl, name)
def cursorx_to_datax(self, cx): def cursorx_to_datax(self, cy, cx):
if cx >= 0 and cx < 8: if cx >= 0 and cx < 8:
return cx // 2 ix = cx // 2
elif cx >= 9 and cx < 17: elif cx >= 9 and cx < 17:
return (cx - 1) // 2 ix = (cx - 1) // 2
elif cx >= 18 and cx < 26: elif cx >= 18 and cx < 26:
return (cx - 2) // 2 ix = (cx - 2) // 2
elif cx >= 27 and cx < 35: elif cx >= 27 and cx < 35:
return (cx - 3) // 2 ix = (cx - 3) // 2
else:
return None
if ix < len(self.rawdata[cy]):
return ix
else: else:
return None return None
def datax_to_cursorx(self, ix): def datax_to_cursorx(self, ix):
@ -546,7 +550,7 @@ class Binary32Buffer(FileBuffer):
else: else:
return None return None
def overwrite_char(self, p, c, act=ACT_NORM, force=False): def overwrite_char(self, p, c, act=ACT_NORM, force=False):
ix = self.cursorx_to_datax(p.x) ix = self.cursorx_to_datax(p.y, p.x)
if ix is None: if ix is None:
return return
Buffer.overwrite_char(self, p, c, act, force) Buffer.overwrite_char(self, p, c, act, force)

View File

@ -50,7 +50,8 @@ class Hex(mode.Fundamental):
(cx, cy) = self.window.cursor.xy() (cx, cy) = self.window.cursor.xy()
s = string.translate(self.window.buffer.rawdata[y], self.ctrans) s = string.translate(self.window.buffer.rawdata[y], self.ctrans)
if cy == y: if cy == y:
i = self.window.buffer.cursorx_to_datax(cx) i = self.window.buffer.cursorx_to_datax(cy, cx)
if i is None: if i is None:
return ((0, s, color.build('green', 'default', 'bold')),) return ((0, s, color.build('green', 'default', 'bold')),)
elif i < len(s) - 1: elif i < len(s) - 1: