commit 1464bd3f3fc9895affadf56d12c68e9751983ad1 Author: Kornel Benko <kor...@lyx.org> Date: Sat May 14 14:49:52 2022 +0200
FindAdv: Amend(2) f845a4e9 Removing '\n' like in previous version with utf8-strings This is needed e.g. for display math, which comes as "\n\\[\n.....\n\\]\n" --- src/lyxfind.cpp | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 480d4d1..e7771a8 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -4014,16 +4014,21 @@ static string convertLF2Space(docstring const &s, bool ignore_format) dospace = false; } } - else if ((pos > start) && - s[pos-1] == '%') { - skip = 1; - while ((pos > start+skip) && (s[pos-1-skip] == '%')) - skip++; - if ((pos > start+skip) && - (s[pos+1] == '~' || isSpace(s[pos+1]) || - s[pos-1-skip] == '~' || isSpace(s[pos-1-skip]))) { - // discard '%%%%%\n' + else if (pos > start) { + if (s[pos-1] == '%') { + skip = 1; + while ((pos > start+skip) && (s[pos-1-skip] == '%')) + skip++; + if ((pos > start+skip) && + (s[pos+1] == '~' || isSpace(s[pos+1]) || + s[pos-1-skip] == '~' || isSpace(s[pos-1-skip]))) { + // discard '%%%%%\n' + dospace = false; + } + } + else if (!isAlnumASCII(s[pos+1]) || !isAlnumASCII(s[pos-1])) { dospace = false; + skip = 0; // remove the '\n' only } } } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs