loleaflet/src/layer/marker/TextInput.js |   18 ++++++++++++++----
 loleaflet/src/map/Map.js                |    2 ++
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit b228a160b942d660a4d8bccf0c14eb7ff9d19920
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Fri Nov 29 17:01:59 2019 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Mon Dec 2 17:34:47 2019 +0100

    formula bar: handling shift+enter correctly
    
    In desktop shift + enter is used for inserting a new line (multiline
    formula input box).
    This patch makes that works for tunneled formula bar too.
    
    Change-Id: Ib1b3fd6593b6361c725cff606925d110c8ac1c83
    Reviewed-on: https://gerrit.libreoffice.org/84170
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>
    Tested-by: Marco Cecchetti <marco.cecche...@collabora.com>

diff --git a/loleaflet/src/layer/marker/TextInput.js 
b/loleaflet/src/layer/marker/TextInput.js
index 9faf1ea29..b23355595 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -17,6 +17,10 @@ L.TextInput = L.Layer.extend({
                // pressed sometimes - consider '  foo' -> ' foo'
                this._deleteHint = ''; // or 'delete' or 'backspace'
 
+               // We need to detect line break in the tunneled formula
+               // input window for the multiline case.
+               this._linebreakHint = false;
+
                // Clearing the area can generate input events
                this._ignoreInputCount = 0;
 
@@ -461,8 +465,12 @@ L.TextInput = L.Layer.extend({
 
                this._lastContent = content;
 
-               if (newText.length > 0)
+               if (this._linebreakHint && this._map.dialog._calcInputBar &&
+                       this._map.getWinId() === 
this._map.dialog._calcInputBar.id) {
+                       this._sendKeyEvent(13, 5376);
+               } else if (newText.length > 0) {
                        this._sendText(String.fromCharCode.apply(null, 
newText));
+               }
 
                // was a 'delete' and we need to reset world.
                if (removeAfter > 0)
@@ -570,12 +578,14 @@ L.TextInput = L.Layer.extend({
        },
 
        _onKeyDown: function _onKeyDown(ev) {
-               if (ev.keyCode == 8)
+               if (ev.keyCode === 8)
                        this._deleteHint = 'backspace';
-               else if (ev.keyCode == 46)
+               else if (ev.keyCode === 46)
                        this._deleteHint = 'delete';
-               else
+               else {
                        this._deleteHint = '';
+                       this._linebreakHint = ev.keyCode === 13 && ev.shiftKey;
+               }
        },
 
        // Check arrow keys on 'keyup' event; using 'ArrowLeft' or 'ArrowRight'
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index b0530df28..b279c1d8a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -812,6 +812,8 @@ L.Map = L.Evented.extend({
        // the main document) has the actual focus.  0 means the document.
        setWinId: function (id) {
                console.log('winId set to: ' + id);
+               if (typeof id === 'string')
+                       id = parseInt(id);
                this._winId = id;
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to