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

New commits:
commit 9ee57c6ac279cf3ea25f1598de6deab6e2d6735a
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Sep 19 09:52:25 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Sep 19 13:35:53 2025 +0200

    don't split surrogate pairs in line breaking
    
    Change-Id: I66e25d3a4e2f360d63bdf7895b1a7d6c8bb0dcfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191188
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 33dec6942173..e0578028f48a 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2205,7 +2205,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