diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index ea21c4737e..a15514b28a 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -248,11 +248,12 @@ class Editor(QMainWindow): def cursor_position(self): c = self.editor.textCursor() char = '' + col = c.positionInBlock() if not c.atStart(): c.clearSelection() - c.setPosition(c.position()-1, c.KeepAnchor) + c.movePosition(c.PreviousCharacter, c.KeepAnchor) char = unicode(c.selectedText()).rstrip('\0') - return (c.blockNumber() + 1, c.positionInBlock(), char) + return (c.blockNumber() + 1, col, char) def cut(self): self.editor.cut()