FindAdv: Partly revert 02c7dbb8. Handle the space in Paragraph.cpp instead.

This commit is contained in:
Kornel Benko 2022-05-04 15:59:57 +02:00
parent 02c7dbb824
commit 9f30de3c5d
2 changed files with 14 additions and 27 deletions

View File

@ -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

View File

@ -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;
}