From 8e256fbf0fb1fdffafe5bb35e18a0746d3ce8d1f Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Wed, 11 May 2022 17:42:50 +0200 Subject: [PATCH] FindAdv: Do not insert space for '\n' if there already are spaces around --- src/lyxfind.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 7048fc2824..8c609a7980 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -3962,10 +3962,11 @@ string MatchStringAdv::normalize(docstring const & s, bool ignore_format) const while ((pos = t.find("\n")) != string::npos) { if (pos > 1 && t[pos-1] == '\\' && t[pos-2] == '\\' ) { // Handle '\\\n' - if (isAlnumASCII(t[pos+1])) { + if (isPrintableNonspace(t[pos+1]) && ((pos < 3) || isPrintableNonspace(t[pos-3]))) { t.replace(pos-2, 3, " "); } else { + // Already a space there t.replace(pos-2, 3, ""); } }