diff --git a/src/calibre/gui2/tweak_book/editor/syntax/base.py b/src/calibre/gui2/tweak_book/editor/syntax/base.py index b0043815ae..752d4e8ab4 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/base.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/base.py @@ -228,7 +228,7 @@ class SyntaxHighlighter(object): def apply_format_changes(self, block, formats): layout = block.layout() preedit_start = layout.preeditAreaPosition() - preedit_length = layout.preeditAreaText().length() + preedit_length = len(layout.preeditAreaText()) if preedit_length != 0 and preedit_start != 0: for r in formats: # Adjust range by pre-edit text, if any diff --git a/src/calibre/gui2/tweak_book/editor/syntax/css.py b/src/calibre/gui2/tweak_book/editor/syntax/css.py index 0af0ad300d..4f6d5c7f11 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/css.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/css.py @@ -8,7 +8,7 @@ __copyright__ = '2013, Kovid Goyal ' import re -from PyQt4.Qt import QTextBlockUserData +from PyQt5.Qt import QTextBlockUserData from calibre.gui2.tweak_book import verify_link from calibre.gui2.tweak_book.editor import syntax_text_char_format, LINK_PROPERTY, CSS_PROPERTY