diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-13 16:12:33 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-06-13 16:12:33 (GMT) |
commit | 89164d1e312ff44eb279cf18d7c4404499555d1b (patch) | |
tree | 3229272c1d8904e9e88b9a74d6b4f952871961d8 /src/corelib/tools | |
parent | 1c20abaaeef1ab448526e5821db06350537c1333 (diff) | |
parent | 2f700c10f3c4287d2c60918e234e92f1524e84d1 (diff) | |
download | Qt-89164d1e312ff44eb279cf18d7c4404499555d1b.zip Qt-89164d1e312ff44eb279cf18d7c4404499555d1b.tar.gz Qt-89164d1e312ff44eb279cf18d7c4404499555d1b.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into qt-4.7-from-4.6
src/3rdparty/webkit merged with checkout --ours
Conflicts:
src/3rdparty/webkit/VERSION
src/3rdparty/webkit/WebCore/ChangeLog
src/3rdparty/webkit/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
src/gui/kernel/qt_s60_p.h
src/gui/text/qfontdatabase_s60.cpp
src/script/api/qscriptengine.cpp
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qtextboundaryfinder.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp index 9205297..bcddcb2 100644 --- a/src/corelib/tools/qtextboundaryfinder.cpp +++ b/src/corelib/tools/qtextboundaryfinder.cpp @@ -131,6 +131,11 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int Line break boundaries give possible places where a line break might happen and sentence boundaries will show the beginning and end of whole sentences. + + The first position in a string is always a valid boundary and + refers to the position before the first character. The last + position at the length of the string is also valid and refers + to the position after the last character. */ /*! @@ -363,7 +368,8 @@ int QTextBoundaryFinder::toNextBoundary() ++pos; break; case Line: - while (pos < length && d->attributes[pos].lineBreakType < HB_Break) + Q_ASSERT(pos); + while (pos < length && d->attributes[pos-1].lineBreakType < HB_Break) ++pos; break; } @@ -405,7 +411,7 @@ int QTextBoundaryFinder::toPreviousBoundary() --pos; break; case Line: - while (pos > 0 && d->attributes[pos].lineBreakType < HB_Break) + while (pos > 0 && d->attributes[pos-1].lineBreakType < HB_Break) --pos; break; } @@ -430,7 +436,7 @@ bool QTextBoundaryFinder::isAtBoundary() const case Word: return d->attributes[pos].wordBoundary; case Line: - return d->attributes[pos].lineBreakType >= HB_Break; + return (pos > 0) ? d->attributes[pos-1].lineBreakType >= HB_Break : true; case Sentence: return d->attributes[pos].sentenceBoundary; } |