summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtextboundaryfinder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qtextboundaryfinder.cpp')
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index 1e12d6e4a3..042f92f1e7 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -374,8 +374,7 @@ int QTextBoundaryFinder::toNextBoundary()
++pos;
break;
case Line:
- Q_ASSERT(pos);
- while (pos < length && d->attributes[pos-1].lineBreakType == HB_NoBreak)
+ while (pos < length && d->attributes[pos].lineBreakType == HB_NoBreak)
++pos;
break;
}
@@ -417,7 +416,7 @@ int QTextBoundaryFinder::toPreviousBoundary()
--pos;
break;
case Line:
- while (pos > 0 && d->attributes[pos-1].lineBreakType == HB_NoBreak)
+ while (pos > 0 && d->attributes[pos].lineBreakType == HB_NoBreak)
--pos;
break;
}
@@ -442,7 +441,7 @@ bool QTextBoundaryFinder::isAtBoundary() const
case Word:
return d->attributes[pos].wordBoundary;
case Line:
- return (pos > 0) ? d->attributes[pos-1].lineBreakType != HB_NoBreak : true;
+ return pos == 0 || d->attributes[pos].lineBreakType != HB_NoBreak;
case Sentence:
return d->attributes[pos].sentenceBoundary;
}
@@ -458,7 +457,7 @@ QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() cons
return NotAtBoundary;
if (! isAtBoundary())
return NotAtBoundary;
- if (t == Line && pos < length && d->attributes[pos-1].lineBreakType == HB_SoftHyphen)
+ if (t == Line && pos < length && d->attributes[pos].lineBreakType == HB_SoftHyphen)
return SoftHyphen;
if (pos == 0) {
if (d->attributes[pos].whiteSpace)