console line-splitting junk

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-05-04 17:55:08 +00:00
parent 968a02d366
commit 2604a599f1
1 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,8 @@ from lex import Grammar, PatternRule
from mode.python import PythonGrammar from mode.python import PythonGrammar
from point import Point from point import Point
LIMIT = 79
class ConsoleExec(method.Method): class ConsoleExec(method.Method):
def _execute(self, w, **vargs): def _execute(self, w, **vargs):
s = w.buffer.make_string() s = w.buffer.make_string()
@ -57,7 +59,21 @@ class ConsoleExec(method.Method):
newlines = [' %s' % x for x in output.split('\n')] newlines = [' %s' % x for x in output.split('\n')]
assert newlines[-1] == ' ' assert newlines[-1] == ' '
newlines[-1] = '' newlines[-1] = ''
b.insert_lines(b.get_buffer_end(), newlines, force=True) newlines2 = []
for line in newlines:
i = 0
while i + LIMIT < len(line):
j = LIMIT
while j > 0 and line[i + j] != ' ':
j -= 1
if j == 0:
newlines2.append(line[i:i + LIMIT])
i += j
else:
newlines2.append(line[i:i + j])
i += j + 1
newlines2.append(line[i:])
b.insert_lines(b.get_buffer_end(), newlines2, force=True)
for w2 in b.windows: for w2 in b.windows:
w2.goto_end() w2.goto_end()