sw/source/core/text/itrcrsr.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit a00961ee98ad361ab27a244e1f2bc30b96a844b4
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Apr 20 21:36:29 2025 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed Apr 30 13:31:40 2025 +0200

    tdf#166260: handle break portion early
    
    Otherwise, it may get handled in the "if ( nWidth )" branch, and
    increment nCurrStart incorrectly.
    
    Change-Id: Ia9fa8a24a9fcc6cfed774a11b0a0b32d6310f47d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184391
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit f2820a2a8414edefe2f1a0eeb611aa70bc99535a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184452
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit cd905ee2b1fe9beb505db43bf5e6fcb82ea17301)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184493
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index f1db92073cba..33126d572bdf 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1594,6 +1594,10 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
     }
     if (TextFrameIndex(1) == nLength || pPor->InFieldGrp())
     {
+        if (pPor->IsBreakPortion())
+        {
+            return nCurrStart;
+        }
         if ( nWidth )
         {
             // no quick return for as-character frames, we want to peek inside
@@ -1642,8 +1646,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
         }
         else
         {
-            if ( pPor->IsPostItsPortion() || pPor->IsBreakPortion() ||
-                 pPor->InToxRefGrp() )
+            if (pPor->IsPostItsPortion() || pPor->InToxRefGrp())
             {
                 SwPostItsPortion* pPostItsPortion = pPor->IsPostItsPortion() ? 
dynamic_cast<SwPostItsPortion*>(pPor) : nullptr;
                 if (pPostItsPortion)

Reply via email to