lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |    8 
++++----
 sw/source/core/edit/edlingu.cxx                                   |    3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 5cfd9fcca36d53e1c6a7f7952771d58299c80c94
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Oct 16 17:56:28 2024 +0500
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 16 23:58:09 2024 +0200

    Revert "tdf#160127: revert 7697ef9d8fbbed7afba10c00ff9f5362d0540cdd"
    
    This reverts commit d9890cc6b9bb5e94fe42ba0216dd5b7e92d11b13.
    The restored change will be amended in a follow-up fix to tdf#160127.
    
    Change-Id: I10eeeb5ccf02969e76e72a46f0705a5ff8909da7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175022
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

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;
commit 4ed57abebbd68fb69af59db1115af1361658e9bf
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Oct 16 17:50:38 2024 +0500
Commit:     Andras Timar <[email protected]>
CommitDate: Wed Oct 16 23:57:57 2024 +0200

    Revert "Return earlier if there are no proposals from Duden checker."
    
    This reverts commit bf980c7b7c8197724cbebd1ed16dfe4401b97392.
    The reason is: the change caused empty entries in the ProofreadingResult's
    aErrors; those didn't even have nErrorType set, and it was 0. Later, in
    SwXTextMarkup::commitMultiTextMarkup, the value of the type was checked,
    and when it was neither SENTENCE nor PROOFREADING, the application of the
    result to the paragraph was aborted. Thus, any paragraph with a spelling
    error without a suggestion wasn't marked as a whole.
    
    A better fix is in works.
    
    Change-Id: Ic5a2c75bb3896f34e60589d5fcbc8e9048dcda9b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175021
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index c1f26d5c9992..e0a9fd8a718d 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -240,10 +240,6 @@ void parseDudenResponse(ProofreadingResult& rResult, 
std::string&& aJSONBody)
     rResult.aErrors = parseJson(
         std::move(aJSONBody), "check-positions",
         [](const boost::property_tree::ptree& rPos, SingleProofreadingError& 
rError) {
-            const auto proposals = rPos.get_child_optional("proposals");
-            if (!proposals || proposals->empty())
-                return;
-
             rError.nErrorStart = rPos.get<int>("offset", 0);
             rError.nErrorLength = rPos.get<int>("length", 0);
             rError.nErrorType = text::TextMarkupType::PROOFREADING;
@@ -251,6 +247,10 @@ void parseDudenResponse(ProofreadingResult& rResult, 
std::string&& aJSONBody)
             //rError.aFullComment = ??
             const std::string sType = rPos.get<std::string>("type", {});
             rError.aProperties = { lcl_GetLineColorPropertyFromErrorId(sType) 
};
+
+            const auto proposals = rPos.get_child_optional("proposals");
+            if (!proposals)
+                return;
             rError.aSuggestions.realloc(std::min(proposals->size(), 
MAX_SUGGESTIONS_SIZE));
             auto itProp = proposals->begin();
             for (auto& rSuggestion : asNonConstRange(rError.aSuggestions))

Reply via email to