fix for mutt text-wrapping when dealing with quoted text

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-09-11 16:06:12 +00:00
parent d0b9d40291
commit fd557125b6
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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