From 967b3fab8716a2e2cc68fd3f0b07c3b6d2c5e7c5 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 26 Nov 2022 11:03:16 +0200 Subject: [PATCH] call ubrk_following() and ubrk_preceding() with the current QTextBoundaryFinder position I remember ubrk_following() and ubrk_preceding() causing a crash if the position is not within the text bounds so leaving the -1 checks just in case Signed-off-by: Ivailo Monev --- src/core/tools/qtextboundaryfinder.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/tools/qtextboundaryfinder.cpp b/src/core/tools/qtextboundaryfinder.cpp index 5cba89c87..18aaf49eb 100644 --- a/src/core/tools/qtextboundaryfinder.cpp +++ b/src/core/tools/qtextboundaryfinder.cpp @@ -312,9 +312,8 @@ int QTextBoundaryFinder::toNextBoundary() return -1; } if (d->pos != -1) { - ubrk_following(d->breakiter, d->pos - 1); + d->pos = ubrk_following(d->breakiter, d->pos); } - d->pos = ubrk_next(d->breakiter); return d->pos; } @@ -329,9 +328,8 @@ int QTextBoundaryFinder::toPreviousBoundary() return -1; } if (d->pos != -1) { - ubrk_preceding(d->breakiter, d->pos + 1); + d->pos = ubrk_preceding(d->breakiter, d->pos); } - d->pos = ubrk_previous(d->breakiter); return d->pos; } -- 2.11.0