FindAdv: Handle negthinspace, negmedspace and negthickspace also in regexes

This commit is contained in:
Kornel Benko 2023-07-20 12:28:35 +02:00
parent e22c1c96e2
commit 11f44c00e0

View File

@ -947,6 +947,9 @@ string correctRegex(string t, bool withformat)
} }
else if (sub.str(4) == "mathcircumflex") else if (sub.str(4) == "mathcircumflex")
replace = "^"; replace = "^";
else if ((sub.str(4) == "negthinspace") || (sub.str(4) == "negmedspace") || (sub.str(4) == "negthickspace")) {
replace = accents[sub.str(4)+"{}"];
}
else if (backslashed) { else if (backslashed) {
backslashed = false; backslashed = false;
if (withformat) { if (withformat) {
@ -1996,11 +1999,11 @@ static void buildAccentsMap()
accents["guillemotleft"] = "«"; accents["guillemotleft"] = "«";
accents["hairspace"] = getutf8(0xf0000); // select from free unicode plane 15 accents["hairspace"] = getutf8(0xf0000); // select from free unicode plane 15
accents["thinspace"] = getutf8(0xf0002); // and used _only_ by findadv accents["thinspace"] = getutf8(0xf0002); // and used _only_ by findadv
accents["negthinspace"] = getutf8(0xf0003); // to omit backslashed latex macros accents["negthinspace{}"]= getutf8(0xf0003); // to omit backslashed latex macros
accents["medspace"] = getutf8(0xf0004); // See https://en.wikipedia.org/wiki/Private_Use_Areas accents["medspace"] = getutf8(0xf0004); // See https://en.wikipedia.org/wiki/Private_Use_Areas
accents["negmedspace"] = getutf8(0xf0005); accents["negmedspace{}"] = getutf8(0xf0005);
accents["thickspace"] = getutf8(0xf0006); accents["thickspace"] = getutf8(0xf0006);
accents["negthickspace"] = getutf8(0xf0007); accents["negthickspace{}"]= getutf8(0xf0007);
accents["lyx"] = getutf8(0xf0010); // Used logos accents["lyx"] = getutf8(0xf0010); // Used logos
accents["LyX"] = getutf8(0xf0010); accents["LyX"] = getutf8(0xf0010);
accents["tex"] = getutf8(0xf0011); accents["tex"] = getutf8(0xf0011);
@ -2090,7 +2093,7 @@ void Intervall::removeAccents()
if (accents.empty()) if (accents.empty())
buildAccentsMap(); buildAccentsMap();
static regex const accre("\\\\(" static regex const accre("\\\\("
"([\\S]|[A-Za-z]+)\\{[^\\\\\\{\\}]+\\}" "([\\S]|[A-Za-z]+)\\{[^\\\\\\{\\}]*\\}"
"|([\\S]|[A-Za-z]+)\\{\\\\[ij](math)?\\}" "|([\\S]|[A-Za-z]+)\\{\\\\[ij](math)?\\}"
"|(" "|("
"(backslash ([lL]y[xX]|[tT]e[xX]|[lL]a[tT]e[xX]e?|lyxarrow))" "(backslash ([lL]y[xX]|[tT]e[xX]|[lL]a[tT]e[xX]e?|lyxarrow))"