- do {
- idx = finder.toNextBoundary();
- if(idx < 0) {
- idx = length;
- wordStart = false;
- wordEnd = false;
- mode = SearchStart;
- } else {
- wordStart = finder.boundaryReasons().testFlag(QTextBoundaryFinder::StartWord);
- wordEnd = finder.boundaryReasons().testFlag(QTextBoundaryFinder::EndWord);
- }
-
- //if(flg) qDebug() << idx << mode << wordStart << wordEnd << contents->plainText.left(idx) << contents->plainText.mid(idx);
+ while((idx = finder.toNextBoundary()) >= 0 && idx <= length) {
+ if(idx < length)
+ idx++; // the boundary is *before* the actual character