some rudimentary fixes for 'auto-fill' deficiencies

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-10-23 20:27:50 +00:00
parent 83ef268436
commit 6c03924d91
2 changed files with 14 additions and 2 deletions

View File

@ -677,6 +677,7 @@ class WrapLine(Method):
class WrapParagraph(Method):
limit = 80
wrapper = WrapLine
spacer = InsertSpace
empty_re = regex.whitespace
prefix_re = None
def _execute(self, w, **vargs):
@ -687,7 +688,7 @@ class WrapParagraph(Method):
self.empty_re.match(w.buffer.lines[i + 1]):
break
EndOfLine().execute(w)
InsertSpace().execute(w)
self.spacer().execute(w)
DeleteRightWhitespace().execute(w)
w.goto(old_cursor)
self.wrapper().execute(w)

View File

@ -1,5 +1,6 @@
import color, mode
import color, method, mode
from lex import Grammar, PatternRule, RegionRule, PatternGroupRule
from mode.text import TextInsertSpace
class RSTString(Grammar):
rules = [
@ -75,5 +76,15 @@ class RST(mode.Fundamental):
'bullet': ('magenta', 'default'),
'enumeration': ('magenta', 'default'),
}
def __init__(self, w):
mode.Fundamental.__init__(self, w)
self.add_action_and_bindings(RstInsertSpace(), ('SPACE',))
self.add_action_and_bindings(RstWrapParagraph(), ('M-q',))
install = RST.install
class RstInsertSpace(TextInsertSpace):
limit = 75
class RstWrapParagraph(method.WrapParagraph):
limit = 75
#spacer = RstInsertSpace