fix for mutt text-wrapping when dealing with quoted text
--HG-- branch : pmacs2
This commit is contained in:
parent
d0b9d40291
commit
fd557125b6
|
@ -637,6 +637,7 @@ class UncommentRegion(Method):
|
||||||
class WrapLine(Method):
|
class WrapLine(Method):
|
||||||
'''Wrap the current line at 80 characters by word'''
|
'''Wrap the current line at 80 characters by word'''
|
||||||
limit = 80
|
limit = 80
|
||||||
|
prefix_re = None
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
cursor = w.logical_cursor()
|
cursor = w.logical_cursor()
|
||||||
old_cursor = cursor
|
old_cursor = cursor
|
||||||
|
@ -667,12 +668,14 @@ class WrapLine(Method):
|
||||||
class WrapParagraph(Method):
|
class WrapParagraph(Method):
|
||||||
limit = 80
|
limit = 80
|
||||||
wrapper = WrapLine
|
wrapper = WrapLine
|
||||||
|
empty_re = regex.whitespace
|
||||||
|
prefix_re = None
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
old_cursor = w.logical_cursor()
|
old_cursor = w.logical_cursor()
|
||||||
i = old_cursor.y
|
i = old_cursor.y
|
||||||
while i < len(w.buffer.lines) - 1:
|
while i < len(w.buffer.lines) - 1:
|
||||||
if i < len(w.buffer.lines) and \
|
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
|
break
|
||||||
EndOfLine().execute(w)
|
EndOfLine().execute(w)
|
||||||
InsertSpace().execute(w)
|
InsertSpace().execute(w)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import re
|
||||||
import color, mode2, method
|
import color, mode2, method
|
||||||
import mode.text
|
import mode.text
|
||||||
from lex3 import Grammar, PatternRule
|
from lex3 import Grammar, PatternRule
|
||||||
|
@ -45,6 +46,7 @@ class MuttWrapLine(method.WrapLine):
|
||||||
|
|
||||||
class MuttWrapParagraph(method.WrapParagraph):
|
class MuttWrapParagraph(method.WrapParagraph):
|
||||||
wrapper = MuttWrapLine
|
wrapper = MuttWrapLine
|
||||||
|
empty_re = re.compile('^[ >\n]*$')
|
||||||
|
|
||||||
class MuttInsertSpace(mode.text.TextInsertSpace):
|
class MuttInsertSpace(mode.text.TextInsertSpace):
|
||||||
limit = 72
|
limit = 72
|
||||||
|
|
Loading…
Reference in New Issue