parent
e02bdd3b19
commit
3cb04bfb18
|
@ -551,23 +551,23 @@ class WrapLine(Method):
|
||||||
p3 = Point(0, cursor.y)
|
p3 = Point(0, cursor.y)
|
||||||
w.buffer.insert_lines(p3, lines)
|
w.buffer.insert_lines(p3, lines)
|
||||||
w.goto(Point(x, y))
|
w.goto(Point(x, y))
|
||||||
|
|
||||||
class WrapParagraph(Method):
|
class WrapParagraph(Method):
|
||||||
limit = 80
|
limit = 80
|
||||||
valid_re = re.compile('^( *)([^ ].*)$')
|
valid_re = re.compile('^( *)([^ ].*)$')
|
||||||
empty_re = regex.whitespace
|
empty_re = regex.whitespace
|
||||||
prefix_re = None
|
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
# we will store the start of our paragaph in p1, and also the original
|
# we will store the start of our paragaph in p1, and also the original
|
||||||
# cursor position.
|
# cursor position.
|
||||||
p1 = oldc = w.logical_cursor()
|
p1 = oldc = w.logical_cursor()
|
||||||
cur_offset = 0
|
cur_offset = 0
|
||||||
|
|
||||||
m = self.valid_re.match(w.buffer.lines[p1.y])
|
m = self.valid_re.match(w.buffer.lines[p1.y])
|
||||||
if not m:
|
if not m:
|
||||||
# the line was empty, so return
|
# the line was empty
|
||||||
return
|
return
|
||||||
elif m.group(1):
|
elif m.group(1):
|
||||||
# the line had leading whitespace, so return
|
# the line had leading whitespace
|
||||||
return
|
return
|
||||||
|
|
||||||
# see if we are starting in the middle of the paragraph; if so, then
|
# see if we are starting in the middle of the paragraph; if so, then
|
||||||
|
|
Loading…
Reference in New Issue