From 08222a89de5e5e0a2aa9a600dd73bec3bee37c59 Mon Sep 17 00:00:00 2001 From: Alan Kilborn Date: Wed, 20 Dec 2023 07:52:26 -0500 Subject: [PATCH] Fix the 2nd replace in cloned document for Replace in Opened Docs Fix #14505, close #14511 --- PowerEditor/src/Notepad_plus.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 4c8dc4226..5e8f8d217 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1287,7 +1287,15 @@ bool Notepad_plus::replaceInOpenedFiles() { for (size_t i = 0, len = _subDocTab.nbItem(); i < len; ++i) { - pBuf = MainFileManager.getBufferByID(_subDocTab.getBufferByIndex(i)); + BufferID bufId = _subDocTab.getBufferByIndex(i); + + if (_mainDocTab.getIndexByBuffer(bufId) != -1) + { + // cloned doc, replacements already done in main doc + continue; + } + + pBuf = MainFileManager.getBufferByID(bufId); if (pBuf->isReadOnly()) continue; _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());