branch : pmacs2
This commit is contained in:
moculus 2007-06-24 13:54:05 +00:00
parent 5cf89f0976
commit 7f95a5cb7d
2 changed files with 10 additions and 0 deletions

View File

@ -327,6 +327,8 @@ class ConsoleBuffer(Buffer):
return console
def __init__(self, nl='\n'):
Buffer.__init__(self, nl)
self.clear()
def clear(self):
lines = ['Python Console\n',
"Evaluate python expressions in the editor's context (self)\n",
'Press Control-] to exit\n',

View File

@ -41,6 +41,7 @@ class Console(mode2.Fundamental):
self.add_bindings('insert-space', ('SPACE',))
self.add_bindings('insert-tab', ('TAB',))
self.add_action_and_bindings(ConsoleExec(), ('RETURN',))
self.add_action_and_bindings(ConsoleClear(), ('C-l',))
self.add_action_and_bindings(ConsoleCancel(), ('C-]',))
self.add_action_and_bindings(ConsoleHistoryPrev(), ('C-p',))
self.add_action_and_bindings(ConsoleHistoryNext(), ('C-n',))
@ -110,6 +111,13 @@ class ConsoleExec(method.Method):
class ConsoleCancel(method.Method):
def execute(self, w, **vargs):
w.application.close_mini_buffer()
class ConsoleClear(method.Method):
def execute(self, w, **vargs):
a = w.application
if not a.has_buffer_name('*Console*'):
raise Exception, "No console found!"
b = a.bufferlist.get_buffer_by_name('*Console*')
b.clear()
class ConsoleHistoryPrev(method.Method):
def execute(self, w, **vargs):