parent
bb00a2d48d
commit
da994c526c
|
@ -653,11 +653,13 @@ class Application(object):
|
||||||
|
|
||||||
i = slot.y_offset + count
|
i = slot.y_offset + count
|
||||||
if lm:
|
if lm:
|
||||||
(lmargin, lattr) = w.mode.get_lmargin(y, x, ended, cont)
|
groups = w.mode.get_lmargin(y, x, ended, cont)
|
||||||
self.win.addstr(i, 0, lmargin, lattr)
|
for (x, lmargin, lattr) in groups:
|
||||||
|
self.win.addstr(i, x, lmargin, lattr)
|
||||||
if rm:
|
if rm:
|
||||||
(rmargin, rattr) = w.mode.get_rmargin(y, x, ended, cont)
|
groups = w.mode.get_rmargin(y, x, ended, cont)
|
||||||
self.win.addstr(i, slot.width - rm, rmargin, rattr)
|
for (x, rmargin, rattr) in groups:
|
||||||
|
self.win.addstr(i, slot.width - rm + x, rmargin, rattr)
|
||||||
|
|
||||||
def _draw_slot_raw(self, i):
|
def _draw_slot_raw(self, i):
|
||||||
slot = self.bufferlist.slots[i]
|
slot = self.bufferlist.slots[i]
|
||||||
|
|
|
@ -223,14 +223,12 @@ class Fundamental(Handler):
|
||||||
self.lmargin = 0
|
self.lmargin = 0
|
||||||
self.rmargin = 1
|
self.rmargin = 1
|
||||||
|
|
||||||
def _null_margin(self, y, x, ended=False, cont=False):
|
def get_rmargin(self, y, x, ended=False, cont=False):
|
||||||
return ('', color.build('default', 'default'))
|
|
||||||
def _continuation_margin(self, y, x, ended=False, cont=False):
|
|
||||||
if cont:
|
if cont:
|
||||||
return ('\\', color.build('red', 'default'))
|
return ((0, '\\', color.build('red', 'default')),)
|
||||||
else:
|
else:
|
||||||
return (' ', color.build('red', 'default'))
|
return ((0, ' ', color.build('red', 'default')),)
|
||||||
def _line_number_margin(self, y, x=0, ended=False, cont=False):
|
def get_lmargin(self, y, x=0, ended=False, cont=False):
|
||||||
lm = self.lmargin
|
lm = self.lmargin
|
||||||
if ended:
|
if ended:
|
||||||
i = int(math.log(y, 10)) + 1
|
i = int(math.log(y, 10)) + 1
|
||||||
|
@ -239,10 +237,7 @@ class Fundamental(Handler):
|
||||||
s = ('% *d' % (lm - 1, y + 1))[-lm:] + ' '
|
s = ('% *d' % (lm - 1, y + 1))[-lm:] + ' '
|
||||||
else:
|
else:
|
||||||
s = ' ' * lm
|
s = ' ' * lm
|
||||||
return (s, color.build('default', 'default', 'bold'))
|
return ((0, s, color.build('default', 'default', 'bold')),)
|
||||||
|
|
||||||
get_lmargin = _line_number_margin
|
|
||||||
get_rmargin = _continuation_margin
|
|
||||||
|
|
||||||
# get mode name
|
# get mode name
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|
24
mode/hex.py
24
mode/hex.py
|
@ -42,13 +42,31 @@ class Hex(mode.Fundamental):
|
||||||
s = ' -------- '
|
s = ' -------- '
|
||||||
elif x == 0:
|
elif x == 0:
|
||||||
s = '0x%08x ' % (y * 16)
|
s = '0x%08x ' % (y * 16)
|
||||||
return (s, color.build('cyan', 'default', 'bold'))
|
return ((0, s, color.build('cyan', 'default', 'bold')),)
|
||||||
def get_rmargin(self, y, x=0, ended=False, cont=False):
|
def get_rmargin(self, y, x=0, ended=False, cont=False):
|
||||||
if ended:
|
if ended:
|
||||||
s = ''
|
return ((0, '', 0),)
|
||||||
else:
|
else:
|
||||||
|
(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)
|
||||||
return (s, color.build('green', 'default', 'bold'))
|
if cy == y:
|
||||||
|
i = None
|
||||||
|
if cx >= 0 and cx < 8:
|
||||||
|
i = cx // 2
|
||||||
|
elif cx >= 9 and cx < 17:
|
||||||
|
i = (cx - 1) // 2
|
||||||
|
elif cx >= 18 and cx < 26:
|
||||||
|
i = (cx - 2) // 2
|
||||||
|
elif cx >= 27 and cx < 35:
|
||||||
|
i = (cx - 3) // 2
|
||||||
|
if i is not None:
|
||||||
|
return ((0, s[0:i], color.build('green', 'default', 'bold')),
|
||||||
|
(0, s[i], color.build('green', 'default', 'bold', 'reverse')),
|
||||||
|
(0, s[i+1:], color.build('green', 'default', 'bold')))
|
||||||
|
else:
|
||||||
|
return ((0, s, color.build('green', 'default', 'bold')),)
|
||||||
|
else:
|
||||||
|
return ((0, s, color.build('green', 'default', 'bold')),)
|
||||||
|
|
||||||
class GotoWord(Method):
|
class GotoWord(Method):
|
||||||
'''Jump to the specified line number'''
|
'''Jump to the specified line number'''
|
||||||
|
|
Loading…
Reference in New Issue