mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix incorrect replace when doing multi S&R and non-leading search expression matches
This commit is contained in:
parent
1e2febdb37
commit
eb10b2d93f
@ -315,7 +315,7 @@ class TextEdit(PlainTextEdit):
|
|||||||
# Center search result on screen
|
# Center search result on screen
|
||||||
self.centerCursor()
|
self.centerCursor()
|
||||||
if save_match is not None:
|
if save_match is not None:
|
||||||
self.saved_matches[save_match] = m
|
self.saved_matches[save_match] = (pat, m)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def all_in_marked(self, pat, template=None):
|
def all_in_marked(self, pat, template=None):
|
||||||
@ -372,7 +372,7 @@ class TextEdit(PlainTextEdit):
|
|||||||
# Center search result on screen
|
# Center search result on screen
|
||||||
self.centerCursor()
|
self.centerCursor()
|
||||||
if save_match is not None:
|
if save_match is not None:
|
||||||
self.saved_matches[save_match] = m
|
self.saved_matches[save_match] = (pat, m)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def replace(self, pat, template, saved_match='gui'):
|
def replace(self, pat, template, saved_match='gui'):
|
||||||
@ -385,8 +385,8 @@ class TextEdit(PlainTextEdit):
|
|||||||
# the saved match matches the currently selected text and
|
# the saved match matches the currently selected text and
|
||||||
# use it, if so.
|
# use it, if so.
|
||||||
if saved_match is not None and saved_match in self.saved_matches:
|
if saved_match is not None and saved_match in self.saved_matches:
|
||||||
saved = self.saved_matches.pop(saved_match)
|
saved_pat, saved = self.saved_matches.pop(saved_match)
|
||||||
if saved.group() == raw:
|
if saved_pat == pat and saved.group() == raw:
|
||||||
m = saved
|
m = saved
|
||||||
if m is None:
|
if m is None:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user