From 9f30de3c5dfc036d2b0b8e51dd935c6300fc7286 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Wed, 4 May 2022 15:59:57 +0200 Subject: [PATCH] FindAdv: Partly revert 02c7dbb8. Handle the space in Paragraph.cpp instead. --- src/Paragraph.cpp | 19 ++++++++++++++----- src/lyxfind.cpp | 22 ---------------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 434e515ccb..df1d905120 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1213,22 +1213,31 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, || contains(style.pass_thru_chars, c) || contains(runparams.pass_thru_chars, c)) { if (runparams.for_search != OutputParams::NoSearch) { - if (c == '\\') + switch (c) { + case '\\': os << "\\\\"; - else if (c == '{') + return; + case '{': os << "\\braceleft "; - else if (c == '}') + return; + case '}': os << "\\braceright "; - else if (c != '\0') + return; + case ' ': + case '\0': + break; + default: os.put(c); + return; + } } else if (c != '\0') { Encoding const * const enc = runparams.encoding; if (enc && !enc->encodable(c)) throw EncodingException(c); os.put(c); + return; } - return; } // TIPA uses its own T3 encoding diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 2c14cbd821..133480546a 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -3138,28 +3138,6 @@ int LatexInfo::dispatch(ostringstream &os, int previousStart, KeyInfo &actual) if (count > 0) interval_.addIntervall(blk, blk+count); } - bool blank_found = false; - // Removing invalid space between - // "item{description}[{...}]" - // and - // "\foreignlanguage{..}" - if (interval_.par[posdown+1] == ' ') { - if (posdown == interval_.par.size() -2) - blank_found = true; - else if (nextKeyIdx > 0) { - for (int i = nextKeyIdx; i < int(entries_.size()); i++) { - if (entries_[i]._tokenstart <= posdown) - continue; - if ((entries_[i].keytype == KeyInfo::isMain) - && (entries_[i]._tokenstart == posdown +2)) { - blank_found = true; - } - break; - } - } - } - if (blank_found) - interval_.addIntervall(posdown+1, posdown+2); } break; }