mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 18:43:39 +02:00
Edit Book: Fix incorrect results when running replace all on marked text and more than one replacement is made. Fixes #1348941 [When applying the command Replace all with marked text, error happens](https://bugs.launchpad.net/calibre/+bug/1348941)
This commit is contained in:
parent
3eb87c29f9
commit
5881287671
1 changed files with 3 additions and 2 deletions
|
|
@ -348,9 +348,10 @@ def all_in_marked(self, pat, template=None):
|
|||
else:
|
||||
raw, count = pat.subn(template, raw)
|
||||
if count > 0:
|
||||
c.setKeepPositionOnInsert(True)
|
||||
start_pos = min(c.anchor(), c.position())
|
||||
c.insertText(raw)
|
||||
c.setKeepPositionOnInsert(False)
|
||||
end_pos = max(c.anchor(), c.position())
|
||||
c.setPosition(start_pos), c.setPosition(end_pos, c.KeepAnchor)
|
||||
self.update_extra_selections()
|
||||
return count
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue