Comment 7 for bug 1265147

Revision history for this message
arspr (arspr) wrote :

I don't know what I'm exactly doing, but I think there's something weird.

I copy my current text.py around that area so you can see what I've modified (just two added prints):

    def keyPressEvent(self, ev):
        QPlainTextEdit.keyPressEvent(self, ev)
        print (ev.key(), Qt.Key_Semicolon, tprefs['replace_entities_as_typed'], self.syntax)
        if ev.key() == Qt.Key_Semicolon and tprefs['replace_entities_as_typed'] and self.syntax == 'html':
            self.replace_possible_entity()

    def replace_possible_entity(self):
        c = self.textCursor()
        c.setPosition(c.position() - min(c.positionInBlock(), 10), c.KeepAnchor)
        text = unicode(c.selectedText())
        m = entity_pat.search(text)
        print (text, m)
        if m is None:

And then as the screenshot shows the problem is that ev.key() for ";" is 44, but Qt.Key_Semicolon is 59 when running Calibre 64-bit. In Calibre 32-bit ";" key is also 59.

Any more tests?