loleaflet/src/control/Control.MobileInput.js |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 04b858d90fb1de00f312efcbf131bacda5479e7c
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Wed Oct 3 17:39:38 2018 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Thu Oct 4 01:05:17 2018 +0200

    android chrome: When autocompleting a word, don't enter it twice.
    
    Most of the text input on Android in Chrome works via the composition;
    only the space has to be entered via textInput.
    
    Change-Id: Icd6cea54a962f324215bb6438265e6500f28421d
    Reviewed-on: https://gerrit.libreoffice.org/61332
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Tested-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/loleaflet/src/control/Control.MobileInput.js 
b/loleaflet/src/control/Control.MobileInput.js
index f03b7ddc9..25b0addff 100644
--- a/loleaflet/src/control/Control.MobileInput.js
+++ b/loleaflet/src/control/Control.MobileInput.js
@@ -145,24 +145,21 @@ L.Control.MobileInput = L.Control.extend({
                }
 
                if (e.type === 'textInput' && !this._keyHandled) {
-                       // Hack for making space and spell-check text insert 
work
-                       // in Chrome (on Andorid) or Chrome with IME.
+                       // Hack for making space in combination with 
autocompletion text
+                       // input work in Chrome on Andorid.
                        //
                        // Chrome (Android) IME triggers keyup/keydown input 
with
                        // code 229 when hitting space (as with all composiiton 
events)
                        // with addition to 'textinput' event, in which we only 
see that
-                       // space was entered. Similar situation is also when 
inserting
-                       // a soft-keyboard spell-check item - it is visible 
only with
-                       // 'textinput' event (no composition event is fired).
-                       // To make this work we need to insert textinput.data 
here..
+                       // space was entered.
                        //
                        // TODO: Maybe make sure this is only triggered when 
keydown has
                        // 229 code. Also we need to detect that composition 
was overriden
                        // (part or whole word deleted) with the spell-checked 
word. (for
                        // example: enter 'tar' and with spell-check correct 
that to 'rat')
                        var data = e.data;
-                       for (var idx = 0; idx < data.length; idx++) {
-                               map._docLayer._postKeyboardEvent('input', 
data[idx].charCodeAt(), 0);
+                       if (data.length == 1 && data[0] === ' ') {
+                               map._docLayer._postKeyboardEvent('input', 
data[0].charCodeAt(), 0);
                        }
                        this._textArea.value = '';
                }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to