diff --git a/application.py b/application.py index 78a24db..0c3718c 100755 --- a/application.py +++ b/application.py @@ -188,6 +188,8 @@ class Application(object): self.config['max_num_kills'] = 64 self.config['word_letters'] = string.letters + string.digits self.config['default_color'] = ('default', 'default',) + self.config['margin'] = 80 + self.config['margin_color'] = 'blue' def completion_window_is_open(self): n = self.complete_slot @@ -778,12 +780,14 @@ class Application(object): count += 1 if w.margins_visible: - for (limit, shade) in w.margins: - if limit < self.x: - for j in range(0, slot.height): - char = chr(self.win.inch(j + slot.y_offset, limit) & 255) - attr = color.build('default', shade, 'bold') - self.win.addstr(j + slot.y_offset, limit + w.mode.lmargin, char, attr) + shade = util.get_margin_color(w, 'blue') + limit = util.get_margin_limit(w, 80) + if limit < self.x: + for j in range(0, slot.height): + char = chr(self.win.inch(j + slot.y_offset, limit) & 255) + attr = color.build('default', shade, 'bold') + self.win.addstr(j + slot.y_offset, limit + w.mode.lmargin, + char, attr) def _draw_slot(self, i): slot = self.bufferlist.slots[i] diff --git a/mode/python.py b/mode/python.py index 42c2b0e..bf86b3e 100644 --- a/mode/python.py +++ b/mode/python.py @@ -77,7 +77,8 @@ class PythonGrammar(Grammar): class PythonTabber(tab.StackTabber): # NOTE: yield might initially seem like an endlevel name, but it's not one. - endlevel_names = ('pass', 'return', 'raise', 'break', 'continue') + # NOTE: return should be an endlevel name but for now it can't b + endlevel_names = ('pass', 'raise', 'break', 'continue') startlevel_names = ('if', 'try', 'class', 'def', 'for', 'while', 'try') def __init__(self, m): tab.StackTabber.__init__(self, m) diff --git a/util.py b/util.py index 1e0cf4b..33f2b73 100644 --- a/util.py +++ b/util.py @@ -47,3 +47,10 @@ def get_margin_limit(w, def_limit=80): return w.application.config[lname] else: return w.application.config.get('margin', def_limit) + +def get_margin_color(w, def_color='blue'): + lname = '%s.margin_color' % w.mode.name().lower() + if lname in w.application.config: + return w.application.config[lname] + else: + return w.application.config.get('margin_color', def_color) diff --git a/window.py b/window.py index 50d27cf..c308e60 100644 --- a/window.py +++ b/window.py @@ -17,7 +17,9 @@ from render import RenderString # the shorter line will "set" the cursor to its position on the shorter line. class Window(object): - margins = ((80, 'blue'),) + #margins = ((80, 'blue'),) + #margin_limit = 80 + #margin_color = 'blue' margins_visible = False def __init__(self, b, a, height=24, width=80, mode_name=None): self.buffer = b