parent
5b4319774d
commit
8b61ef8cf1
14
mode/text.py
14
mode/text.py
|
@ -15,9 +15,9 @@ class WordRule(PatternRule):
|
|||
if m:
|
||||
s = m.group(0)
|
||||
if self._spelled_ok(s):
|
||||
token = Token('word', self, lexer.y, lexer.x, s, None, parent, {})
|
||||
token = Token('text.word', self, lexer.y, lexer.x, s, None, parent, {})
|
||||
else:
|
||||
token = Token('misspelled', self, lexer.y, lexer.x, s, None, parent, {})
|
||||
token = Token('text.misspelled', self, lexer.y, lexer.x, s, None, parent, {})
|
||||
token.color = lexer.get_color(token)
|
||||
lexer.x += len(s)
|
||||
yield token
|
||||
|
@ -31,8 +31,8 @@ class TextGrammar(Grammar):
|
|||
rules = [
|
||||
ContinuedRule(),
|
||||
WordRule(),
|
||||
PatternRule(r'punct', r'[^a-zA-Z0-9_]'),
|
||||
PatternRule(r'stuff', r'[a-zA-Z0-9_]+'),
|
||||
PatternRule(r'text.punct', r'[^a-zA-Z0-9_]'),
|
||||
PatternRule(r'text.stuff', r'[a-zA-Z0-9_]+'),
|
||||
]
|
||||
|
||||
class TextWrapParagraph(method.WrapParagraph):
|
||||
|
@ -85,5 +85,11 @@ class Text(Fundamental):
|
|||
'text-insert-space': ('SPACE',),
|
||||
'text-wrap-paragraph': ('M-q',),
|
||||
}
|
||||
colors = {
|
||||
'text.punct': ('default', 'default'),
|
||||
'text.stuff': ('default', 'default'),
|
||||
'text.word': ('default', 'default'),
|
||||
'text.misspelled': ('red', 'default'),
|
||||
}
|
||||
|
||||
install = Text.install
|
||||
|
|
Loading…
Reference in New Issue