* Prevent text field scroll jump when hovering over kanji characters.
authorUrban Wallasch <urban.wallasch@freenet.de>
Thu, 24 Jun 2021 11:03:59 +0000 (13:03 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Thu, 24 Jun 2021 11:03:59 +0000 (13:03 +0200)
jiten-pai.py
kanjidic.py

index 1a338b26f73e5165c2499cc9c8db7bbe66ac034d..ff415f317cba0beb74f5ea100ccf8c83d2d253a1 100755 (executable)
@@ -429,12 +429,12 @@ class zQTextEdit(QTextEdit):
     def mouseMoveEvent(self, event):
         pos = event.pos()
         pos.setX(pos.x() - 15)
+        scr = self.verticalScrollBar().value()
         old_tcur = self.textCursor()
         tcur = self.cursorForPosition(pos)
         self.setTextCursor(tcur)
         tcur.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor);
         char = tcur.selectedText()
-        scr = self.verticalScrollBar().value()
         self.setTextCursor(old_tcur)
         self.verticalScrollBar().setValue(scr)
         if is_kanji(char):
index d1e74177b6b00ba4b07e2f4c7fd5ee7124992023..60297d1ab7bee1e6aafcd23c3b5e36561185fc73 100755 (executable)
@@ -332,12 +332,12 @@ class zQTextEdit(QTextEdit):
     def mouseMoveEvent(self, event):
         pos = event.pos()
         pos.setX(pos.x() - 15)
+        scr = self.verticalScrollBar().value()
         old_tcur = self.textCursor()
         tcur = self.cursorForPosition(pos)
         self.setTextCursor(tcur)
         tcur.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor);
         char = tcur.selectedText()
-        scr = self.verticalScrollBar().value()
         self.setTextCursor(old_tcur)
         self.verticalScrollBar().setValue(scr)
         if is_kanji(char):