[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 5 07:57:43 UTC 2019


 vcl/unx/gtk3/gtk3gtkframe.cxx |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit 98ce2ed834a31a520ccba4c59751d74ac8937de1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 4 19:57:26 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 5 09:57:00 2019 +0200

    ctrl+shift+e emoji ibus engine problems converting UCS-4 positions to UTF-16
    
    e.g. ctrl+shift+e type rabbit then space in writer and the len of underline
    is 2 which should encompass the displayed e + 2 UTF-16 units
    
    Change-Id: I424db7dd6cbcc5845922ac17208fed643e672dbd
    Reviewed-on: https://gerrit.libreoffice.org/78615
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 899b2161eefe..e4c4f45a3dd9 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -4047,6 +4047,29 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
             sal_attr |= ExtTextInputAttr::Underline;
         g_slist_free (attr_list);
 
+        // rhbz#1648281 make underline work with the UCS-4 positions we're given
+        if (!pThis->m_aInputEvent.maText.isEmpty())
+        {
+            sal_Int32 i(0), nLen = pThis->m_aInputEvent.maText.getLength();
+
+            sal_Int32 nUTF16Start(0);
+            while (i < start && nUTF16Start < nLen)
+            {
+                pThis->m_aInputEvent.maText.iterateCodePoints(&nUTF16Start);
+                ++i;
+            }
+
+            sal_Int32 nUTF16End(nUTF16Start);
+            while (i < end && nUTF16End < nLen)
+            {
+                pThis->m_aInputEvent.maText.iterateCodePoints(&nUTF16End);
+                ++i;
+            }
+
+            start = nUTF16Start;
+            end = nUTF16End;
+        }
+
         // Set the sal attributes on our text
         for (int i = start; i < end; ++i)
         {


More information about the Libreoffice-commits mailing list