editeng/source/editeng/impedit2.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 23efced60cb7e08bf17b10e3e1ea5802e68a0cc6
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu May 7 22:47:06 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri May 8 11:02:15 2020 +0200

    tdf#102625: fix Formula editor breaks surrogate pairs
    
    Change-Id: I616cda97367a8fdfb6ae10eb687ca7490a943692
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93684
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index ffa93a144efd..124b310ca249 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -49,6 +49,8 @@
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/system/XSystemShellExecute.hpp>
 
+#include <rtl/character.hxx>
+
 #include <sal/log.hxx>
 #include <o3tl/safeint.hxx>
 #include <osl/diagnose.h>
@@ -3829,6 +3831,13 @@ sal_Int32 ImpEditEngine::GetChar(
                             nChar = ( std::abs( nRight - nChar ) < std::abs( 
nLeft - nChar ) ) ? nRight : nLeft;
                         }
                     }
+                    else
+                    {
+                        OUString aStr(pParaPortion->GetNode()->GetString());
+                        // tdf#102625: don't select middle of a pair of 
surrogates with mouse cursor
+                        if (rtl::isSurrogate(aStr[nChar]))
+                            --nChar;
+                    }
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to