slight fixes to improve text handling
--HG-- branch : pmacs2
This commit is contained in:
parent
e0ee3dac6f
commit
63810fb143
|
@ -657,6 +657,7 @@ class UncommentRegion(Method):
|
|||
# wrapping/justifying/etc
|
||||
class WrapLine(Method):
|
||||
limit = 80
|
||||
space_re = re.compile(' +')
|
||||
def _token_len(self, tokens):
|
||||
l = 0
|
||||
for t in tokens:
|
||||
|
@ -679,7 +680,8 @@ class WrapLine(Method):
|
|||
i -= 1
|
||||
return i, x, y
|
||||
def _clear_preceeding_spaces(self, tokens, x, y):
|
||||
while tokens and tokens[0].isspace():
|
||||
#while tokens and tokens[0].isspace():
|
||||
while tokens and self.space_re.match(tokens[0]):
|
||||
if x > 0:
|
||||
x = max(0, x - len(tokens[0]))
|
||||
del tokens[0]
|
||||
|
@ -710,7 +712,8 @@ class WrapLine(Method):
|
|||
lines, x, y = self._wrap_line(w.buffer.lines[y], x, y)
|
||||
if lines is None:
|
||||
return
|
||||
w.buffer.delete_line(cursor.y)
|
||||
#w.buffer.delete_line(cursor.y)
|
||||
w.buffer.delete(Point(0, cursor.y), Point(len(w.buffer.lines[cursor.y]), cursor.y))
|
||||
w.buffer.insert_lines(Point(0, cursor.y), lines)
|
||||
w.goto(Point(x, y))
|
||||
class WrapParagraph(WrapLine):
|
||||
|
|
|
@ -43,7 +43,8 @@ class Mutt(mode.Fundamental):
|
|||
class MuttWrapLine(method.WrapLine):
|
||||
limit = 72
|
||||
|
||||
class MuttWrapParagraph(method.WrapParagraph):
|
||||
#class MuttWrapParagraph(method.WrapParagraph):
|
||||
class MuttWrapParagraph(method.WrapParagraph2):
|
||||
wrapper = MuttWrapLine
|
||||
empty_re = re.compile('^[ >\n]*$')
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ class Text(mode.Fundamental):
|
|||
|
||||
class TextInsertSpace(method.Method):
|
||||
limit = 80
|
||||
wrapper = method.WrapParagraph
|
||||
#wrapper = method.WrapParagraph
|
||||
wrapper = method.WrapParagraph2
|
||||
def execute(self, w, **vargs):
|
||||
w.insert_string_at_cursor(' ')
|
||||
cursor = w.logical_cursor()
|
||||
|
|
Loading…
Reference in New Issue