Пример #1
0
 def replace_possible_entity(self):
     c = self.textCursor()
     c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
     text = unicode(c.selectedText()).rstrip('\0')
     m = entity_pat.search(text)
     if m is None:
         return
     ent = m.group()
     repl = xml_entity_to_unicode(m)
     if repl != ent:
         c.setPosition(c.position() + m.start(), c.KeepAnchor)
         c.insertText(repl)
Пример #2
0
 def replace_possible_entity(self):
     c = self.textCursor()
     c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
     text = unicode(c.selectedText()).rstrip('\0')
     m = entity_pat.search(text)
     if m is None:
         return
     ent = m.group()
     repl = xml_entity_to_unicode(m)
     if repl != ent:
         c.setPosition(c.position() + m.start(), c.KeepAnchor)
         c.insertText(repl)
Пример #3
0
 def replace_possible_entity(self, editor):
     c = editor.textCursor()
     c.insertText(';')
     c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
     text = editor.selected_text_from_cursor(c)
     m = entity_pat.search(text)
     if m is not None:
         ent = m.group()
         repl = xml_entity_to_unicode(m)
         if repl != ent:
             c.setPosition(c.position() + m.start(), c.KeepAnchor)
             c.insertText(repl)
             editor.setTextCursor(c)
Пример #4
0
 def replace_possible_entity(self, editor):
     c = editor.textCursor()
     c.insertText(';')
     c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
     text = editor.selected_text_from_cursor(c)
     m = entity_pat.search(text)
     if m is not None:
         ent = m.group()
         repl = xml_entity_to_unicode(m)
         if repl != ent:
             c.setPosition(c.position() + m.start(), c.KeepAnchor)
             c.insertText(repl)
             editor.setTextCursor(c)