diff --git a/method.py b/method.py index 7659843..2c10db6 100644 --- a/method.py +++ b/method.py @@ -637,6 +637,7 @@ class UncommentRegion(Method): class WrapLine(Method): '''Wrap the current line at 80 characters by word''' limit = 80 + prefix_re = None def _execute(self, w, **vargs): cursor = w.logical_cursor() old_cursor = cursor @@ -667,12 +668,14 @@ class WrapLine(Method): class WrapParagraph(Method): limit = 80 wrapper = WrapLine + empty_re = regex.whitespace + prefix_re = None def _execute(self, w, **vargs): old_cursor = w.logical_cursor() i = old_cursor.y while i < len(w.buffer.lines) - 1: if i < len(w.buffer.lines) and \ - regex.whitespace.match(w.buffer.lines[i + 1]): + self.empty_re.match(w.buffer.lines[i + 1]): break EndOfLine().execute(w) InsertSpace().execute(w) diff --git a/mode/mutt.py b/mode/mutt.py index 9f1b04d..6517921 100644 --- a/mode/mutt.py +++ b/mode/mutt.py @@ -1,3 +1,4 @@ +import re import color, mode2, method import mode.text from lex3 import Grammar, PatternRule @@ -45,6 +46,7 @@ class MuttWrapLine(method.WrapLine): class MuttWrapParagraph(method.WrapParagraph): wrapper = MuttWrapLine + empty_re = re.compile('^[ >\n]*$') class MuttInsertSpace(mode.text.TextInsertSpace): limit = 72