better console highlighting

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-02-22 22:48:22 +00:00
parent 692fc51706
commit df8ea5f391
2 changed files with 5 additions and 4 deletions

View File

@ -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*'

View File

@ -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$'),