Acount for all non-negative spaces used by lyx

The unicode representation in an ascii-string string is
\302\240                                Normal space
\342\200\257                            Non-breaking Thin (1/6 em)
\342\200\213\342\200\205\342\200\213    Medium(2/9 em)
\342\200\213\342\200\204\342\200\213    Thick (5/18 em)
\342\201\240\342\200\202\342\201\240    Half Quad(0.5 em)
\342\200\203                            Quad(1 em)
\342\200\203\342\200\203                Double Quad(2 em)
\342\220\243                            Visible space

'Double Quad' counts as 2 spaces, all others count as 1 space in the search regex
This commit is contained in:
Kornel Benko 2023-07-18 13:09:55 +02:00
parent cd080da3c4
commit 8eda9e25e0

View File

@ -831,13 +831,47 @@ string string2regex(string in)
// normal blanks // normal blanks
blanks++; blanks++;
} }
else if ((tempx[i] == '\302' && tempx[i+1] == '\240') else if (tempx[i] == '\302' && tempx[i+1] == '\240') {
|| (tempx[i] == '\342' && tempx[i+1] == '\202')) { // Normal Space
// protected space
// thin space
blanks++; blanks++;
i++; i++;
} }
else if (tempx[i] == '\342') {
if (tempx[i+1] == '\200') {
if ((tempx[i+2] == '\257')
|| (tempx[i+2] == '\203')
|| (tempx[i+2] == '\202')) {
// Non-breaking Thin (1/6 em)
// Quad(1 em), (Double quad counts as 2 blanks)
// Half Quad
blanks++;
i += 2;
}
else if (tempx[i+2] == '\213') {
// Ignoring parts of Medium and Thick
i += 2;
continue;
}
else if ((tempx[i+2] == '\204') || (tempx[i+2] == '\205')) {
// Thick
// Medium
blanks++;
i += 2;
}
}
else if (tempx[i+1] == '\201') {
if (tempx[i+2] == '\240') {
// Ignoring parts of half quad
i += 2;
continue;
}
}
else if ((tempx[i+1] == '\220') && (tempx[i+2] == '\243')) {
// Visible space
blanks++;
i += 2;
}
}
else { else {
if (blanks > 0) { if (blanks > 0) {
temp += getRegexSpaceCount(blanks); temp += getRegexSpaceCount(blanks);