editeng/source/editeng/impedit3.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f85bd2d586cfea5ca9c2892b8b48e240df5d3ccc
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Sep 19 09:52:25 2025 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Mon Sep 22 14:49:48 2025 +0200

    don't split surrogate pairs in line breaking
    
    Change-Id: I66e25d3a4e2f360d63bdf7895b1a7d6c8bb0dcfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191186
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit e32ca8b6c7f742e26c5fd0dc8d082bf73f17cf82)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191348
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 85a21a39c20b..30ccb092ec0f 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2163,7 +2163,12 @@ void ImpEditEngine::ImpBreakLine(ParaPortion& 
rParaPortion, EditLine& rLine, Tex
             nBreakPos = nMaxBreakPos;
             // I18N nextCharacters !
             if ( nBreakPos <= rLine.GetStart() )
-                nBreakPos = rLine.GetStart() + 1;  // Otherwise infinite loop!
+            {
+                // Move to next character, otherwise infinite loop!
+                nBreakPos = rLine.GetStart();
+                // Use iterateCodePoints to avoid splitting surrogate-pairs
+                pNode->GetString().iterateCodePoints(&nBreakPos, 1);
+            }
         }
     }
 

Reply via email to