Macro IDE: replace-and-find only replaces if current selection is matching search expression

This commit is contained in:
Matthias Koefferlein 2021-06-09 21:53:41 +02:00
parent 4cb477a91d
commit 2337149eb5
1 changed files with 5 additions and 1 deletions

View File

@ -1135,7 +1135,11 @@ MacroEditorPage::replace_and_find_next (const QString &replace)
QTextCursor c = mp_text->textCursor ();
if (c.hasSelection ()) {
c.insertText (interpolate_string (replace, m_current_search));
QTextBlock b = c.block ();
int o = std::max (0, c.position () - b.position ());
if (m_current_search.indexIn (b.text (), o) == o) {
c.insertText (interpolate_string (replace, m_current_search));
}
}
find_next ();