sc/source/ui/view/gridwin.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit bdea5805c0344cbddb5c68d1fd19d3cd3b6e3afd
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Feb 21 11:05:41 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Feb 25 15:23:00 2022 +0100

    tdf#81894 sc spelling: close EditView when moving outside cell
    
    In a previous patch, we noted that instead of a spelling suggestion,
    a popup was displayed. This patch handles that unfinished business.
    
    1.) Open LOv4304.ods from bug 81894 comment 6.
    2.) double-click on cell B4 (to enter edit mode)
    3.) right click on "spellng" which appears to be in D4
    
    Before any of the patches, this did nothing.
    After the first base patch, it was showing the format popup.
    Now it offers a spelling suggestion.
    
    [By running EnterHandler, we are accepting any changes made
     so far in editing mode. That is consistent with what happens
     if a left-click selects a different cell.]
    
    Change-Id: I23876a26861b695dc46efa42f6c3fed6fdb8da6a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130299
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0f01233d64a9..f99eb0b350c4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3199,6 +3199,15 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
             nCellY = mrViewData.GetEditViewRow();
         else
             bPosIsInEditView = false;
+
+        if (!bPosIsInEditView)
+        {
+            // Close the edit view when moving outside of the edited cell
+            // to avoid showing the edit popup, or providing the wrong 
EditView to spellcheck.
+            ScInputHandler* pHdl = pScMod->GetInputHdl();
+            if (pHdl)
+                pHdl->EnterHandler();
+        }
     }
 
     bool bSpellError = false;

Reply via email to