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.
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) 'replace_ entities_ as_typed' ], self.syntax) 'replace_ entities_ as_typed' ] and self.syntax == 'html':
self. replace_ possible_ entity( )
print (ev.key(), Qt.Key_Semicolon, tprefs[
if ev.key() == Qt.Key_Semicolon and tprefs[
def replace_ possible_ entity( self):
c.setPosition( c.position( ) - min(c.positionI nBlock( ), 10), c.KeepAnchor) c.selectedText( )) pat.search( text)
c = self.textCursor()
text = unicode(
m = entity_
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?