From cf184f1dd4e6c17b4c1a8a915cf9c2613739467e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 22 Jan 2019 14:36:04 +0100 Subject: [PATCH] Android: If there is no surrounding text then don't try to delete it If there is no surrounding text then we can save time by not sending an event to delete it as there is nothing to be deleted. This prevents the underlying widget from being confused as to where the cursor and anchor is later on when entering in new text. Fixes: QTBUG-65584 Change-Id: Ic6325c119327048dffd2baa68520871fb56370d5 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidinputcontext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index cdc52e1cb4..c31e43e0bb 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -978,6 +978,10 @@ jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint right m_composingText.clear(); m_composingTextStart = -1; + QString text = query->value(Qt::ImSurroundingText).toString(); + if (text.isEmpty()) + return JNI_TRUE; + if (leftLength < 0) { rightLength += -leftLength; leftLength = 0;