branch : pmacs2
This commit is contained in:
moculus 2008-05-28 19:22:45 +00:00
parent 166285a8e2
commit c33b23f95b
1 changed files with 7 additions and 14 deletions

View File

@ -18,7 +18,7 @@ class IperlExec(method.Method):
w.mode.hindex = len(w.mode.history) - 1 w.mode.hindex = len(w.mode.history) - 1
a = w.application a = w.application
b = w.mode._get_iperl() b = w.mode.get_iperl()
if a.window().buffer is not b: if a.window().buffer is not b:
a.switch_buffer(b) a.switch_buffer(b)
p = a.get_mini_buffer_prompt() p = a.get_mini_buffer_prompt()
@ -33,7 +33,7 @@ class IperlTab(method.Method):
def execute(self, w, **vargs): def execute(self, w, **vargs):
a = w.application a = w.application
s = w.buffer.make_string() s = w.buffer.make_string()
b = w.mode._get_iperl() b = w.mode.get_iperl()
x2 = w.logical_cursor().x x2 = w.logical_cursor().x
if not s or s[:x2].isspace(): if not s or s[:x2].isspace():
@ -103,7 +103,7 @@ class IperlMini(mode.Fundamental):
IperlPageUp, IperlPageDown, IperlGotoBeginning, IperlGotoEnd] IperlPageUp, IperlPageDown, IperlGotoBeginning, IperlGotoEnd]
readre = re.compile('^([A-Z]+):(.*)\n$') readre = re.compile('^([A-Z]+):(.*)\n$')
def _readline(self): def _readline(self):
b = self._get_iperl() b = self.get_iperl()
line = b.pipe.stdout.readline() line = b.pipe.stdout.readline()
m = self.readre.match(line) m = self.readre.match(line)
if m: if m:
@ -111,7 +111,7 @@ class IperlMini(mode.Fundamental):
else: else:
return ('RAW', line.rstrip()) return ('RAW', line.rstrip())
def _read(self): def _read(self):
b = self._get_iperl() b = self.get_iperl()
output = [] output = []
while True: while True:
(type_, value) = self._readline() (type_, value) = self._readline()
@ -127,21 +127,14 @@ class IperlMini(mode.Fundamental):
else: else:
return '' return ''
def _get_iperl(self): def get_iperl(self):
a = self.window.application return self.window.buffer.method.main_buffer
if not a.has_buffer_name('*IPerl*'):
b = buffer.IperlBuffer(None)
a.add_buffer(b)
window.Window(b, a)
else:
b = a.bufferlist.get_buffer_by_name('*IPerl*')
return b
def __init__(self, w): def __init__(self, w):
mode.Fundamental.__init__(self, w) mode.Fundamental.__init__(self, w)
self.history = [''] self.history = ['']
self.hindex = 0 self.hindex = 0
b = self._get_iperl() b = self.get_iperl()
w.application.set_mini_buffer_prompt(b.prompt) w.application.set_mini_buffer_prompt(b.prompt)
self.add_bindings('iperl-exec', ('RETURN',)) self.add_bindings('iperl-exec', ('RETURN',))
self.add_bindings('console-clear', ('C-l',)) self.add_bindings('console-clear', ('C-l',))