diff --git a/application.py b/application.py index 3d958f2..e9f4515 100755 --- a/application.py +++ b/application.py @@ -142,7 +142,8 @@ class Application(object): # window/slot height/width height = self.y - 2 - width = self.x - 1 + #width = self.x - 1 + width = self.x # run user custom code here self.rcerror = None @@ -558,7 +559,7 @@ class Application(object): (x, y) = w.first.xy() (vy, vx) = (None, None) while count < slot.height: - if p.y == y and p.x >= x and p.x <= x + swidth: + if p.y == y and p.x >= x and p.x < x + swidth: (vy, vx) = (slot.y_offset + count, p.x - x + w.mode.lmargin) break if x + swidth >= len(w.buffer.lines[y]): @@ -689,7 +690,6 @@ class Application(object): x = 0 y += 1 else: - self.win.addstr(slot.y_offset + count, slot.width, '\\', redattr) x += swidth # move on to the next physical line @@ -738,7 +738,6 @@ class Application(object): if token_wrap: self._draw_line_margins(slot, count, w, y, x) - self.win.addstr(k, slot.width, '\\', redattr) x += swidth count += 1 if token_done: diff --git a/code_examples/DataIntegrator.pm b/code_examples/DataIntegrator.pm index 1595dd6..b42fdde 100644 --- a/code_examples/DataIntegrator.pm +++ b/code_examples/DataIntegrator.pm @@ -3165,4 +3165,3 @@ sub __add_misc_data } 1; - diff --git a/mode/__init__.py b/mode/__init__.py index 68cbb47..b5b5aee 100644 --- a/mode/__init__.py +++ b/mode/__init__.py @@ -215,12 +215,13 @@ class Fundamental(Handler): def enable_line_numbers(self): self.show_line_numbers = True - self.lmargin = 4 - self.get_lmargin = self._line_number_margin + l = len(self.window.buffer.lines) + self.lmargin = int(math.log(l, 10)) + 3 + self.rmargin = 0 def disable_line_numbers(self): self.show_line_numbers = False self.lmargin = 0 - self.get_lmargin = self._null_margin + self.rmargin = 1 def get_rmargin(self, y, x, ended=False, cont=False): return ('', color.build('default', 'default')) @@ -228,20 +229,20 @@ class Fundamental(Handler): return ('', color.build('default', 'default')) def _continuation_margin(self, y, x, ended=False, cont=False): if cont: - return ('\\', color.build('green', 'default')) + return ('\\', color.build('red', 'default')) else: - return ('x', color.build('green', 'default')) + return (' ', color.build('red', 'default')) def _line_number_margin(self, y, x=0, ended=False, cont=False): + lm = self.lmargin if ended: i = int(math.log(y, 10)) + 1 - s = ('% 3s' % ('-' * i))[-3:] + ' ' + s = ('% *s' % (lm - 1, '-' * i))[-lm:] + ' ' elif x == 0: - s = ('% 3d' % (y + 1))[-3:] + ' ' + s = ('% *d' % (lm - 1, y + 1))[-lm:] + ' ' else: - s = ' ' + s = ' ' * lm return (s, color.build('default', 'default', 'bold')) - get_lmargin = _null_margin - #get_rmargin = _null_margin + get_lmargin = _line_number_margin get_rmargin = _continuation_margin # get mode name