mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Justify row correctly after double space
The wordSpacing property of a QFont object applies only once when there are multiple spaces between words. Therefore Row::Element::countSeparators shall not count spaces, but groups of spaces. Fixes bug #9808.
This commit is contained in:
parent
1814739853
commit
b5871decc0
14
src/Row.cpp
14
src/Row.cpp
@ -41,7 +41,19 @@ int Row::Element::countSeparators() const
|
||||
{
|
||||
if (type != STRING)
|
||||
return 0;
|
||||
return count(str.begin(), str.end(), ' ');
|
||||
// Consecutive spaces count as only one separator.
|
||||
bool wasspace = false;
|
||||
int nsep = 0;
|
||||
for (size_t i = 0 ; i < str.size() ; ++i) {
|
||||
if (str[i] == ' ') {
|
||||
if (!wasspace) {
|
||||
++nsep;
|
||||
wasspace = true;
|
||||
}
|
||||
} else
|
||||
wasspace = false;
|
||||
}
|
||||
return nsep;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user