X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FRow.cpp;h=bd0945961f415eb44e8768534652dee672038ee2;hb=5b5b1a451512026f4d201f60c9228313037ed735;hp=5bdcbe004bbb46f7443a30e1b05c6e3e7160bf31;hpb=32edb65985a8e63340c0421d76c00956bf846fd2;p=lyx.git diff --git a/src/Row.cpp b/src/Row.cpp index 5bdcbe004b..bd0945961f 100644 --- a/src/Row.cpp +++ b/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; }