sw/source/core/edit/edlingu.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7697ef9d8fbbed7afba10c00ff9f5362d0540cdd
Author:     Gökay Şatır <gokaysa...@collabora.com>
AuthorDate: Thu Nov 2 13:37:46 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Nov 28 14:28:42 2023 +0100

    Proof reading suggestions:
    
    * When user right clicks an underlined part of the sentence, we are 
checking if there is a suggestion list.
    * Then we show the suggestions.
    
    Sometimes spell checker algorithms send 2 lists for the same part of the 
sentence.
    And we saw that one of these lists can be empty (no suggestions).
    But since we check if there is a list, the empty list is shown to the user.
    
    I updated the checks here and added a new condition:
    Now we take the list if the list is not empty.
    This way, we can find the not-empty list which may come after an empty list 
(for the same part of the sentence).
    
    Signed-off-by: Gökay Şatır <gokaysa...@collabora.com>
    Change-Id: Ib3b498b98a8d44f8a7ead99593a71adcefa87a82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158832
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit 4c6c60d44b0056cbe08b6e75baacbc0df0cd1742)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159908
    Tested-by: Jenkins

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index e1f6d631139d..5731d2b2be49 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1031,7 +1031,8 @@ bool SwEditShell::GetGrammarCorrection(
                 auto pError = std::find_if(std::cbegin(rResult.aErrors), 
std::cend(rResult.aErrors),
                     [rErrorPosInText, nLen](const 
linguistic2::SingleProofreadingError &rError) {
                         return rError.nErrorStart <= rErrorPosInText
-                            && rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength; });
+                            && rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength
+                            && rError.aSuggestions.size() > 0; });
                 if (pError != std::cend(rResult.aErrors))
                 {
                     rSuggestions = pError->aSuggestions;

Reply via email to