diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index c4d5c18383..605ccd10e2 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -198,7 +198,8 @@ class TextEdit(QPlainTextEdit): else: c.setPosition(c.block().position() + col) if c.blockNumber() + 1 > lnum: - c.movePosition(c.PreviousBlock) + # We have moved past the end of the line + c.setPosition(c.block().position()) c.movePosition(c.EndOfBlock) self.setTextCursor(c) self.ensureCursorVisible()