Edit book: When wrapping selected text in a tag, preserve the selection after wrapping. Fixes #2050100 [small problem in edit-mode](https://bugs.launchpad.net/calibre/+bug/2050100)

This commit is contained in:
Kovid Goyal 2024-02-07 07:20:42 +05:30
parent c72d7d1d43
commit 219a1572f6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -500,8 +500,10 @@ class Smarts(NullSmarts):
text = self.get_smart_selection(editor, update=True)
c = editor.textCursor()
pos = min(c.position(), c.anchor())
sellen = abs(c.position() - c.anchor())
c.insertText(f'{opent}{text}{close}')
c.setPosition(pos + len(opent))
c.setPosition(c.position() + sellen, QTextCursor.MoveMode.KeepAnchor)
editor.setTextCursor(c)
def verify_for_spellcheck(self, cursor, highlighter):