mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix column number of cursor one less than it should be.
Also fix non-BMP characters before cursor not being reported correctly.
This commit is contained in:
parent
4c9e1733ec
commit
a8d8f92e9f
@ -248,11 +248,12 @@ class Editor(QMainWindow):
|
|||||||
def cursor_position(self):
|
def cursor_position(self):
|
||||||
c = self.editor.textCursor()
|
c = self.editor.textCursor()
|
||||||
char = ''
|
char = ''
|
||||||
|
col = c.positionInBlock()
|
||||||
if not c.atStart():
|
if not c.atStart():
|
||||||
c.clearSelection()
|
c.clearSelection()
|
||||||
c.setPosition(c.position()-1, c.KeepAnchor)
|
c.movePosition(c.PreviousCharacter, c.KeepAnchor)
|
||||||
char = unicode(c.selectedText()).rstrip('\0')
|
char = unicode(c.selectedText()).rstrip('\0')
|
||||||
return (c.blockNumber() + 1, c.positionInBlock(), char)
|
return (c.blockNumber() + 1, col, char)
|
||||||
|
|
||||||
def cut(self):
|
def cut(self):
|
||||||
self.editor.cut()
|
self.editor.cut()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user