buildAccentsMap();
//LYXERR0("correctRegex input '" << t << "'");
+ int skip = 0;
for (sregex_iterator it(t.begin(), t.end(), wordre), end; it != end; ++it) {
sub = *it;
string replace;
replace = "";
backslashed = true;
}
+ else if (withformat && next[0] == '$') {
+ replace = accents["lyxdollar"];
+ skip = 1; // Skip following '$'
+ }
}
}
else if (sub.str(4) == "mathcircumflex")
if (lastpos < (size_t) sub.position(2))
s += std::regex_replace(t.substr(lastpos, sub.position(2) - lastpos), protectedSpace, R"( )");
s += replace;
- lastpos = sub.position(2) + sub.length(2);
+ lastpos = sub.position(2) + sub.length(2) + skip;
+ skip = 0;
}
if (lastpos == 0)
s = std::regex_replace(t, protectedSpace, R"( )");
// Replace all other \n with spaces
t.replace(pos, 1, " ");
}
- }
- if (!ignore_format) {
- size_t count = 0;
- while ((pos > count + 1) && (t[pos - 1 -count] == '%')) {
- count++;
- }
- if (count > 0) {
- t.replace(pos - count, count, "");
+ if (!ignore_format) {
+ size_t count = 0;
+ while ((pos > count + 1) && (t[pos - 1 -count] == '%')) {
+ count++;
+ }
+ if (count > 0) {
+ t.replace(pos - count, count, "");
+ }
}
}
}