summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-09-04 19:57:26 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2019-09-05 11:09:20 +0200
commitadd68a1a3f5466ecf567df79119a1cade4058401 (patch)
tree53ff7371269cf4ea3f81976d29f51c2dd34ea2b3
parentRelated tdf#118809: add some XDatabaseMetaData for Firebird (diff)
downloadcore-add68a1a3f5466ecf567df79119a1cade4058401.tar.gz
core-add68a1a3f5466ecf567df79119a1cade4058401.zip
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/78616 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 994fb356eb53..742e0097def7 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -4026,6 +4026,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)
{