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

New commits:
commit cd905ee2b1fe9beb505db43bf5e6fcb82ea17301
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Apr 20 21:36:29 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Apr 23 12:40:25 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>

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index a96433017296..e98f1cd4e459 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1604,6 +1604,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
@@ -1652,8 +1656,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