This commit is contained in:
Kovid Goyal 2014-11-21 14:23:12 +05:30
parent 2dff34fab4
commit ad2ffc8fe2

View File

@ -269,12 +269,13 @@ def set_style_property(tag, property_name, value, editor):
d.setProperty(property_name, value) d.setProperty(property_name, value)
c.insertText('"%s"' % css(d)) c.insertText('"%s"' % css(d))
entity_pat = re.compile(r'&(#{0,1}[a-zA-Z0-9]{1,8});$')
class Smarts(NullSmarts): class Smarts(NullSmarts):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
NullSmarts.__init__(self, *args, **kwargs) NullSmarts.__init__(self, *args, **kwargs)
self.last_matched_tag = None self.last_matched_tag = None
self.entity_pat = re.compile(r'&(#{0,1}[a-zA-Z0-9]{1,8});$')
def get_extra_selections(self, editor): def get_extra_selections(self, editor):
ans = [] ans = []
@ -544,7 +545,7 @@ class Smarts(NullSmarts):
c.insertText(';') c.insertText(';')
c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor) c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
text = editor.selected_text_from_cursor(c) text = editor.selected_text_from_cursor(c)
m = self.entity_pat.search(text) m = entity_pat.search(text)
if m is not None: if m is not None:
ent = m.group() ent = m.group()
repl = xml_entity_to_unicode(m) repl = xml_entity_to_unicode(m)