From df8ea5f3910286a7c431217056c92b8c265e083e Mon Sep 17 00:00:00 2001 From: moculus Date: Sun, 22 Feb 2009 22:48:22 +0000 Subject: [PATCH] better console highlighting --HG-- branch : pmacs2 --- buffer/console.py | 8 ++++---- mode/ipython.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/buffer/console.py b/buffer/console.py index 5ff6e8a..caba2e3 100644 --- a/buffer/console.py +++ b/buffer/console.py @@ -4,7 +4,7 @@ from buffer import Buffer console = None class ConsoleBuffer(Buffer): btype = 'console' - modename = 'console' + modename = 'ipython' def __new__(cls, *args, **kwargs): global console if console is None: @@ -15,9 +15,9 @@ class ConsoleBuffer(Buffer): Buffer.__init__(self) self.clear() def clear(self): - lines = ['Python Console\n', - "Evaluate python expressions in the editor's context (self)\n", - 'Press Control-] to exit\n'] + lines = ['# Python Console\n', + "# Evaluate python expressions in the editor's context (self)\n", + '# Press Control-] to exit\n'] console.set_data(''.join(lines), force=True) def name(self): return '*Console*' diff --git a/mode/ipython.py b/mode/ipython.py index 0dd6bee..f545e58 100644 --- a/mode/ipython.py +++ b/mode/ipython.py @@ -4,6 +4,7 @@ from mode.python import StringGrammar1, StringGrammar2, PythonGrammar class IpythonGrammar(Grammar): rules = [ + PatternRule(r'comment', r'#.*$'), RegionRule(r'string', r'"', StringGrammar2, r'"'), RegionRule(r'string', r"'", StringGrammar1, r"'"), RegionRule(r'ipython_input', r'^(?:>>>|\.\.>)', PythonGrammar, '\n$'),