diff --git a/src/calibre/gui2/tweak_book/editor/smarts/python.py b/src/calibre/gui2/tweak_book/editor/smarts/python.py index 3dc97a0e79..6271a76203 100644 --- a/src/calibre/gui2/tweak_book/editor/smarts/python.py +++ b/src/calibre/gui2/tweak_book/editor/smarts/python.py @@ -15,7 +15,7 @@ from calibre.gui2.tweak_book.editor.smarts import NullSmarts def get_text_before_cursor(editor): cursor = editor.textCursor() cursor.clearSelection() - cursor.movePosition(cursor.StartOfLine, cursor.KeepAnchor) + cursor.movePosition(cursor.StartOfBlock, cursor.KeepAnchor) text = cursor.selectedText() return cursor, text