diff --git a/method.py b/method.py index f349ec9..7f6cd3f 100644 --- a/method.py +++ b/method.py @@ -112,7 +112,7 @@ class AboutPmacs(Method): if not a.has_buffer_name('*About*'): b = buffer.AboutBuffer() a.add_buffer(b) - window.Window(b, w.application) + window.Window(b, a) b = a.bufferlist.get_buffer_by_name('*About*') if a.window().buffer is not b: a.switch_buffer(b) @@ -713,7 +713,7 @@ class WrapLine(Method): w.buffer.delete_line(cursor.y) w.buffer.insert_lines(Point(0, cursor.y), lines) w.goto(Point(x, y)) -class WrapParagraph2(WrapLine): +class WrapParagraph(WrapLine): limit = 80 empty_re = regex.whitespace prefix_re = regex.leading_whitespace @@ -734,21 +734,19 @@ class WrapParagraph2(WrapLine): line = w.buffer.lines[y2 + 1] if self.empty_re.match(line): break - lines.append(line.strip()) y2 += 1 - y2 -= 1 + lines.append(line.strip()) x, y = c.xy() - lines, x, y = self._wrap_line(w.buffer.lines[y], x, y) + longline = ' '.join(lines) + lines, x, y = self._wrap_line(longline, x, y) if lines is None: return - w.set_error(repr(lines)) - w.buffer.delete(Point(x1, y1), Point(x2, y2)) w.buffer.insert_lines(Point(0, c.y), lines) w.goto(Point(x, y)) -class WrapParagraph(Method): +class WrapParagraph2(Method): limit = 80 wrapper = WrapLine spacer = InsertSpace diff --git a/mode/text.py b/mode/text.py index 5e21f94..c6aa363 100644 --- a/mode/text.py +++ b/mode/text.py @@ -49,7 +49,7 @@ class Text(mode.Fundamental): def __init__(self, w): mode.Fundamental.__init__(self, w) self.add_action_and_bindings(LearnWord(), ('C-c l',)) - self.add_action_and_bindings(TextInsertSpace(), ('SPACE',)) + #self.add_action_and_bindings(TextInsertSpace(), ('SPACE',)) self.add_action_and_bindings(method.WrapParagraph(), ('M-q',)) class TextInsertSpace(method.Method):