diff --git a/method/__init__.py b/method/__init__.py index 4069362..f47d8fa 100644 --- a/method/__init__.py +++ b/method/__init__.py @@ -787,6 +787,7 @@ class WrapParagraph(WrapLine): w.goto(Point(x, y)) class WrapParagraph2(Method): limit = 80 + valid_re = re.compile('^( *)([^ ].*)$') empty_re = regex.whitespace prefix_re = None def _execute(self, w, **vargs): @@ -795,6 +796,14 @@ class WrapParagraph2(Method): p1 = oldc = w.logical_cursor() cur_offset = 0 + m = self.valid_re.match(w.buffer.lines[p1.y]) + if not m: + # the line was empty, so return + return + elif m.group(1): + # the line had leading whitespace, so return + return + # see if we are starting in the middle of the paragraph; if so, then # let's find the actual begining, and update p1 accordingly. i = p1.y