[LyX/master] FindAdv: Handling of '%' in searched string while not ignoring format

Kornel Benko kornel at lyx.org
Fri Apr 15 14:40:55 UTC 2022


commit 45756a50b4e47c3fe182e77f8e976011db7cc070
Author: Kornel Benko <kornel at lyx.org>
Date:   Fri Apr 15 17:09:08 2022 +0200

    FindAdv: Handling of '%' in searched string while not ignoring format
    
    Difficult to decide, when to remove the sequence '%\n'.
    The sequence is OK for latex output as a command separator,
    but must be removed in searched string.
    
    Alas, not all occurences are wrong. Sigh.
---
 src/lyxfind.cpp |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 6ef7cd3..015e437 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -3878,14 +3878,9 @@ string MatchStringAdv::normalize(docstring const & s, bool ignore_format) const
 	// Remove \n at begin
 	while (!t.empty() && t[0] == '\n')
 		t = t.substr(1);
-	// Remove [%]*\n at end
+	// Remove \n* at end
 	while (!t.empty() && t[t.size() - 1] == '\n') {
-		size_t count = 1;
-		if (!ignore_format) {
-			while ((t.size() > 1 + count) && (t[t.size() - 1 - count] == '%'))
-				count++;
-		}
-		t = t.substr(0, t.size() - count);
+		t = t.substr(0, t.size() - 1);
 	}
 	size_t pos;
 	// Handle all other '\n'


More information about the lyx-cvs mailing list