mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
c72d7d1d43
commit
219a1572f6
@ -500,8 +500,10 @@ class Smarts(NullSmarts):
|
|||||||
text = self.get_smart_selection(editor, update=True)
|
text = self.get_smart_selection(editor, update=True)
|
||||||
c = editor.textCursor()
|
c = editor.textCursor()
|
||||||
pos = min(c.position(), c.anchor())
|
pos = min(c.position(), c.anchor())
|
||||||
|
sellen = abs(c.position() - c.anchor())
|
||||||
c.insertText(f'{opent}{text}{close}')
|
c.insertText(f'{opent}{text}{close}')
|
||||||
c.setPosition(pos + len(opent))
|
c.setPosition(pos + len(opent))
|
||||||
|
c.setPosition(c.position() + sellen, QTextCursor.MoveMode.KeepAnchor)
|
||||||
editor.setTextCursor(c)
|
editor.setTextCursor(c)
|
||||||
|
|
||||||
def verify_for_spellcheck(self, cursor, highlighter):
|
def verify_for_spellcheck(self, cursor, highlighter):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user