parent
d6d80218ef
commit
8a978c7104
|
@ -466,6 +466,7 @@ class Fundamental(Handler):
|
||||||
|
|
||||||
def region_added(self, p, newlines):
|
def region_added(self, p, newlines):
|
||||||
mname = self.name
|
mname = self.name
|
||||||
|
|
||||||
if self.lexer is not None:
|
if self.lexer is not None:
|
||||||
ydelta = len(newlines) - 1
|
ydelta = len(newlines) - 1
|
||||||
xdelta = len(newlines[-1])
|
xdelta = len(newlines[-1])
|
||||||
|
@ -487,12 +488,11 @@ class Fundamental(Handler):
|
||||||
ghist.setdefault(name, {})
|
ghist.setdefault(name, {})
|
||||||
ghist[name][newp] = self.ghist[name][gp]
|
ghist[name][newp] = self.ghist[name][gp]
|
||||||
self.ghist = ghist
|
self.ghist = ghist
|
||||||
|
|
||||||
if self.tabber is not None:
|
if self.tabber is not None:
|
||||||
self.tabber.region_added(p, newlines)
|
self.tabber.region_added(p, newlines)
|
||||||
if self.context is not None:
|
if self.context is not None:
|
||||||
self.context.region_added(p, newlines)
|
self.context.region_added(p, newlines)
|
||||||
if self.lmargin != 0:
|
|
||||||
self.enable_line_numbers()
|
|
||||||
|
|
||||||
def region_removed(self, p1, p2):
|
def region_removed(self, p1, p2):
|
||||||
if self.lexer is not None:
|
if self.lexer is not None:
|
||||||
|
@ -522,7 +522,5 @@ class Fundamental(Handler):
|
||||||
self.tabber.region_removed(p1, p2)
|
self.tabber.region_removed(p1, p2)
|
||||||
if self.context is not None:
|
if self.context is not None:
|
||||||
self.context.region_removed(p1, p2)
|
self.context.region_removed(p1, p2)
|
||||||
if self.lmargin != 0:
|
|
||||||
self.enable_line_numbers()
|
|
||||||
|
|
||||||
install = Fundamental.install
|
install = Fundamental.install
|
||||||
|
|
20
mode/hex.py
20
mode/hex.py
|
@ -122,10 +122,17 @@ class HexOverwriteChar(Method):
|
||||||
hb = w.application.methods['hex-backward']
|
hb = w.application.methods['hex-backward']
|
||||||
(cx, cy) = w.cursor.xy()
|
(cx, cy) = w.cursor.xy()
|
||||||
ix = b.cursorx_to_datax(cy, cx)
|
ix = b.cursorx_to_datax(cy, cx)
|
||||||
|
if ix is None:
|
||||||
|
return
|
||||||
|
lm1 = w.mode.lmargin
|
||||||
cx2 = w.buffer.datax_to_cursorx(ix)
|
cx2 = w.buffer.datax_to_cursorx(ix)
|
||||||
w.goto(Point(cx2, cy))
|
w.goto(Point(cx2, cy))
|
||||||
|
lm2 = w.mode.lmargin
|
||||||
w.overwrite_char_at_cursor(self.part1)
|
w.overwrite_char_at_cursor(self.part1)
|
||||||
|
lm3 = w.mode.lmargin
|
||||||
w.overwrite_char_at_cursor(self.part2)
|
w.overwrite_char_at_cursor(self.part2)
|
||||||
|
lm4 = w.mode.lmargin
|
||||||
|
w.set_error('%r/%r/%r/%r' % (lm1, lm2, lm3, lm4))
|
||||||
elif self.char not in string.hexdigits:
|
elif self.char not in string.hexdigits:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -219,8 +226,8 @@ class Hex(mode.Fundamental):
|
||||||
config = {
|
config = {
|
||||||
'hex.disinst': 'disinst',
|
'hex.disinst': 'disinst',
|
||||||
}
|
}
|
||||||
lmargin = 12
|
#lmargin = 12
|
||||||
rmargin = 18
|
#rmargin = 18
|
||||||
_ctrans = ['.'] * 256
|
_ctrans = ['.'] * 256
|
||||||
byteorder = 'native'
|
byteorder = 'native'
|
||||||
byteorders = {
|
byteorders = {
|
||||||
|
@ -240,8 +247,8 @@ class Hex(mode.Fundamental):
|
||||||
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')
|
hlo = color.build('red', 'default')
|
||||||
hhi = color.build('default', 'red')
|
hhi = color.build('default', 'red')
|
||||||
format = "%(flag)s %(bname)-18s (%(mname)s) {%(symbolic)s} %(cursor)s %(perc)s"
|
format = "%(flag)s %(bname)-18s (%(mname)s) {%(symbolic)s} %(cursor)s %(perc)s"
|
||||||
|
@ -272,6 +279,11 @@ class Hex(mode.Fundamental):
|
||||||
mode.Fundamental.__init__(self, w)
|
mode.Fundamental.__init__(self, w)
|
||||||
self.bindings = {}
|
self.bindings = {}
|
||||||
|
|
||||||
|
self.lmargin = 12
|
||||||
|
self.rmargin = 18
|
||||||
|
self.header = 1
|
||||||
|
self.footer = 0
|
||||||
|
|
||||||
self.add_bindings('center-view', ('C-l',))
|
self.add_bindings('center-view', ('C-l',))
|
||||||
self.add_bindings('next-line', ('C-n', 'D_ARROW',))
|
self.add_bindings('next-line', ('C-n', 'D_ARROW',))
|
||||||
self.add_bindings('previous-line', ('C-p', 'U_ARROW',))
|
self.add_bindings('previous-line', ('C-p', 'U_ARROW',))
|
||||||
|
|
|
@ -35,7 +35,8 @@ class RenderString(object):
|
||||||
s = '%-*s' % (x2 - x, self.string)
|
s = '%-*s' % (x2 - x, self.string)
|
||||||
else:
|
else:
|
||||||
s = self.string
|
s = self.string
|
||||||
|
assert self.x + x != 115
|
||||||
cwin.addstr(self.y + y, self.x + x, s, self.attrs)
|
cwin.addstr(self.y + y, self.x + x, s, self.attrs)
|
||||||
except:
|
except:
|
||||||
v = (y, self.x, x, self.string, self.attrs)
|
v = (self.y, y, self.x, x, self.string, self.attrs)
|
||||||
raise Exception, "cwin.addstr(%d, %d + %d, %r, %r) failed" % v
|
raise Exception, "cwin.addstr(%d + %d, %d + %d, %r, %r) failed" % v
|
||||||
|
|
Loading…
Reference in New Issue