add support for links nad fix learn-word

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2011-03-07 01:14:23 -05:00
parent 842a50017f
commit 8774fe5106
1 changed files with 3 additions and 1 deletions

View File

@ -29,6 +29,7 @@ class ContinuedRule(RegionRule):
class TextGrammar(Grammar): class TextGrammar(Grammar):
rules = [ rules = [
PatternRule(r'text.link', r'[a-z]+://[^ ]*[^- .,;:]'),
ContinuedRule(), ContinuedRule(),
WordRule(), WordRule(),
PatternRule(r'text.punct', r'[^a-zA-Z0-9_]'), PatternRule(r'text.punct', r'[^a-zA-Z0-9_]'),
@ -58,7 +59,7 @@ class LearnWord(method.Method):
for token in w.buffer.highlights[w.mode.name].tokens[cursor.y]: for token in w.buffer.highlights[w.mode.name].tokens[cursor.y]:
if (token.x <= cursor.x and if (token.x <= cursor.x and
token.end_x() > cursor.x and token.end_x() > cursor.x and
token.name == 'misspelled'): token.name == 'text.misspelled'):
word = token.string word = token.string
if word is None: if word is None:
@ -86,6 +87,7 @@ class Text(Fundamental):
'text-wrap-paragraph': ('M-q',), 'text-wrap-paragraph': ('M-q',),
} }
colors = { colors = {
'text.link': ('cyan', 'default'),
'text.punct': ('default', 'default'), 'text.punct': ('default', 'default'),
'text.stuff': ('default', 'default'), 'text.stuff': ('default', 'default'),
'text.word': ('default', 'default'), 'text.word': ('default', 'default'),