bugs about wrapping

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-11-10 19:58:12 +00:00
parent f8680694b3
commit 86af2469d4
5 changed files with 20 additions and 8 deletions

View File

@ -15,7 +15,7 @@ def get_speller():
return _speller
def free():
if _speller:
_speller.close()
_speller.stop()
class Speller(object):
def __init__(self, cmd='ispell'):

View File

@ -630,6 +630,8 @@ class WrapParagraph(Method):
# stringify our paragraph
s = " ".join(lines)
#raise Exception, '%r %r' % (limit, s)
# ok, so now we need to find the line breaks
newlines = []
while s:
@ -658,6 +660,8 @@ class WrapParagraph(Method):
y += 1
k += 1
#assert len(newlines), 'fooga: %r %r' % (limit, s)
# kill the old paragraph region, insert the new, and goto the new cursor
w.delete(p1, Point(len(w.buffer.lines[i-1]), i-1))
w.insert_lines(p1, newlines)

View File

@ -44,10 +44,11 @@ class RSTGrammar(Grammar):
]
class RstInsertSpace(TextInsertSpace):
limit = 75
class RstWrapParagraph(method.WrapParagraph):
limit = 75
class RstInsertSpace(TextInsertSpace):
limit = 75
wrapper = RstWrapParagraph
class RST(mode.Fundamental):
modename = 'RST'
@ -99,6 +100,9 @@ class RST(mode.Fundamental):
}
actions = [RstInsertSpace, RstWrapParagraph]
config = {
'rst.margin': 75,
}
def __init__(self, w):
mode.Fundamental.__init__(self, w)
self.add_bindings('rst-insert-space', ('SPACE',))

View File

@ -76,6 +76,9 @@ class Text(mode.Fundamental):
extensions=['.txt']
grammar = TextGrammar
actions = [LearnWord, TextInsertSpace, TextWrapParagraph]
config = {
'text.margin': 78,
}
def __init__(self, w):
mode.Fundamental.__init__(self, w)
self.add_bindings('learn-word', ('C-c l',))

View File

@ -21,5 +21,6 @@ class Text2(mode.text.Text):
'text2_email': ('cyan', 'default', 'bold'),
'text2_url': ('green', 'default', 'bold'),
}
config = {}
install = Text2.install