parent
fc1dc11edf
commit
318d35c436
|
@ -796,7 +796,10 @@ class Application(object):
|
||||||
rstrs = w.mode.get_header()
|
rstrs = w.mode.get_header()
|
||||||
assert len(rstrs) >= w.mode.header
|
assert len(rstrs) >= w.mode.header
|
||||||
for j in range(0, w.mode.header):
|
for j in range(0, w.mode.header):
|
||||||
rstrs[j].draw(self.win, slot.y_offset + j, slot.x_offset, slot.width)
|
k = 0
|
||||||
|
for rstr in rstrs[j]:
|
||||||
|
rstr.draw(self.win, slot.y_offset + j, slot.x_offset + k, slot.width)
|
||||||
|
k += len(rstr.string)
|
||||||
|
|
||||||
# draw the actual slot
|
# draw the actual slot
|
||||||
self._draw_slot(i)
|
self._draw_slot(i)
|
||||||
|
|
|
@ -332,9 +332,9 @@ class Fundamental(Handler):
|
||||||
|
|
||||||
if self.tabber is None:
|
if self.tabber is None:
|
||||||
s = "Header support is not available for this mode"
|
s = "Header support is not available for this mode"
|
||||||
hs = [RenderString(s=s, attrs=color.build(fg, bg))]
|
hs = [[RenderString(s=s, attrs=color.build(fg, bg))]]
|
||||||
while len(hs) < 3:
|
while len(hs) < 3:
|
||||||
hs.insert(0, RenderString(s='', attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s='', attrs=color.build(fg, bg))])
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
w = self.window
|
w = self.window
|
||||||
|
@ -358,14 +358,14 @@ class Fundamental(Handler):
|
||||||
if ws and marker.level > ws:
|
if ws and marker.level > ws:
|
||||||
continue
|
continue
|
||||||
s = w.buffer.lines[marker.y][:w.width - 1]
|
s = w.buffer.lines[marker.y][:w.width - 1]
|
||||||
hs.insert(0, RenderString(s=s, attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s=s, attrs=color.build(fg, bg))])
|
||||||
while len(hs) < 3:
|
while len(hs) < 3:
|
||||||
hs.insert(0, RenderString(s='', attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s='', attrs=color.build(fg, bg))])
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
def get_footer(self):
|
def get_footer(self):
|
||||||
fg, bg = "default", "red"
|
fg, bg = "default", "red"
|
||||||
return [RenderString(s='footer', attrs=color.build(fg, bg))]
|
return [[RenderString(s='footer', attrs=color.build(fg, bg))]]
|
||||||
def get_rmargin(self, w, y, x, ended=False, cont=False):
|
def get_rmargin(self, w, y, x, ended=False, cont=False):
|
||||||
c, fg, bg = " ", "red", "default"
|
c, fg, bg = " ", "red", "default"
|
||||||
if cont:
|
if cont:
|
||||||
|
|
37
mode/hex.py
37
mode/hex.py
|
@ -162,6 +162,14 @@ class HexToggleSymbolic(Method):
|
||||||
w.set_error("Symbolic editing enabled")
|
w.set_error("Symbolic editing enabled")
|
||||||
else:
|
else:
|
||||||
w.set_error("Symbolic editing disabled")
|
w.set_error("Symbolic editing disabled")
|
||||||
|
class HexLiteral(Method):
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
w.mode.symbolic_edit = False
|
||||||
|
w.set_error("Symbolic editing disabled")
|
||||||
|
class HexSymbolic(Method):
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
w.mode.symbolic_edit = True
|
||||||
|
w.set_error("Symbolic editing enabled")
|
||||||
|
|
||||||
class ShowX86Instruction(Method):
|
class ShowX86Instruction(Method):
|
||||||
''''''
|
''''''
|
||||||
|
@ -228,16 +236,37 @@ class Hex(mode.Fundamental):
|
||||||
ctrans = ''.join(_ctrans)
|
ctrans = ''.join(_ctrans)
|
||||||
actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord,
|
actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord,
|
||||||
HexStartOfLine, HexEndOfLine, ShowAddress, ShowX86Instruction,
|
HexStartOfLine, HexEndOfLine, ShowAddress, ShowX86Instruction,
|
||||||
GotoAddress, HexSetByteOrder, HexToggleSymbolic,
|
GotoAddress, HexSetByteOrder, HexToggleSymbolic, HexSymbolic, HexLiteral,
|
||||||
HexOverwriteCharSpace, HexOverwriteCharTab,
|
HexOverwriteCharSpace, HexOverwriteCharTab,
|
||||||
HexOverwriteCharNewline, HexGotoBeginning, HexGotoEnd]
|
HexOverwriteCharNewline, HexGotoBeginning, HexGotoEnd]
|
||||||
|
|
||||||
header = 1
|
header = 1
|
||||||
header_size = 1
|
header_size = 1
|
||||||
|
hlo = color.build('red', 'default')
|
||||||
|
hhi = color.build('default', 'red')
|
||||||
|
format = "%(flag)s %(bname)-18s (%(mname)s) {%(symbolic)s} %(cursor)s %(perc)s"
|
||||||
|
|
||||||
|
def get_status_names(self):
|
||||||
|
names = mode.Fundamental.get_status_names(self)
|
||||||
|
if self.symbolic_edit:
|
||||||
|
names['symbolic'] = 'symbolic'
|
||||||
|
else:
|
||||||
|
names['symbolic'] = 'literal'
|
||||||
|
return names
|
||||||
|
|
||||||
def get_header(self):
|
def get_header(self):
|
||||||
s = ' 87654321 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff' \
|
s0 = ' 87654321 '
|
||||||
'%*s0123456789abcdef ' % (self.window.width - 48, '')
|
s1 = '00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff'
|
||||||
return [RenderString(s=s, attrs=color.build('red', 'default'))]
|
s2 = ' ' * (self.window.width - 48)
|
||||||
|
s3 = '0123456789abcdef '
|
||||||
|
|
||||||
|
def lo(s): return RenderString(s=s, attrs=self.hlo)
|
||||||
|
def hi(s): return RenderString(s=s, attrs=self.hhi)
|
||||||
|
|
||||||
|
if self.symbolic_edit:
|
||||||
|
return [[lo(s0), lo(s1), lo(s2), hi(s3)]]
|
||||||
|
else:
|
||||||
|
return [[lo(s0), hi(s1), lo(s2), lo(s3)]]
|
||||||
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode.Fundamental.__init__(self, w)
|
mode.Fundamental.__init__(self, w)
|
||||||
|
|
|
@ -584,9 +584,9 @@ class Python(mode.Fundamental):
|
||||||
|
|
||||||
if self.tabber is None:
|
if self.tabber is None:
|
||||||
s = "Header support is not available for this mode"
|
s = "Header support is not available for this mode"
|
||||||
hs = [RenderString(s=s, attrs=color.build(fg, bg))]
|
hs = [[RenderString(s=s, attrs=color.build(fg, bg))]]
|
||||||
while len(hs) < 3:
|
while len(hs) < 3:
|
||||||
hs.insert(0, RenderString(s='', attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s='', attrs=color.build(fg, bg))])
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
w = self.window
|
w = self.window
|
||||||
|
@ -610,9 +610,9 @@ class Python(mode.Fundamental):
|
||||||
if ws and marker.level > ws:
|
if ws and marker.level > ws:
|
||||||
continue
|
continue
|
||||||
s = w.buffer.lines[marker.y][:w.width - 1]
|
s = w.buffer.lines[marker.y][:w.width - 1]
|
||||||
hs.insert(0, RenderString(s=s, attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s=s, attrs=color.build(fg, bg))])
|
||||||
while len(hs) < 3:
|
while len(hs) < 3:
|
||||||
hs.insert(0, RenderString(s='', attrs=color.build(fg, bg)))
|
hs.insert(0, [RenderString(s='', attrs=color.build(fg, bg))])
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
|
|
Loading…
Reference in New Issue