sc/source/ui/view/gridwin.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit a24eac37fbf8a325b09c3b575c568621a696a560
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Feb 21 11:48:48 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri Feb 25 15:24:54 2022 +0100

    tdf#81894 sc spelling: re-close EditView if not spelling error
    
    In order to check if there is a spelling error,
    the code had to open an EditView. If there was no spelling error
    at the mouse pointer, then stop edit mode again before showing
    the context menu so the full popup is shown, not just the edit one.
    
    1.) Open LOv4304.ods from bug 81894 comment 6.
    2.) right click on "The" in B3
    
    Since we haven't been in edit mode, it should show the full
    format popup. Before this patch series, that is what happened,
    so this follow-up patch is critical to preventing a regression.
    
    This patch makes use of a variable created in earlier patches
    to fix other issues related to right-click spelling.
    
    Change-Id: Ia9713e9654c1f74bc926d51fe8bc5180a8265c79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130300
    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 f99eb0b350c4..d92d2109cdd1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3325,8 +3325,14 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
             Link<SpellCallbackInfo&,void> aLink = LINK( this, ScGridWindow, 
PopupSpellingHdl );
             bDone = pEditView->ExecuteSpellPopup(aMenuPos, aLink);
 
-            if (pHdl && pHdl->GetEditString() != sOldText)
+            // If the spelling is corrected, stop editing to flush any cached 
spelling info.
+            // Or, if no misspelled word at this position, and it wasn't 
initially in edit mode,
+            // then exit the edit mode in order to get the full context popup 
(not edit popup).
+            if (pHdl && (pHdl->GetEditString() != sOldText
+                         || (!bDone && !bPosIsInEditView)))
+            {
                 pHdl->EnterHandler();
+            }
 
             if (!bDone && nColSpellError != nCellX)
             {

Reply via email to