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 <gokaysatir@collabora.com>
Change-Id: Ib3b498b98a8d44f8a7ead99593a71adcefa87a82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158832
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 4c6c60d44b0056cbe08b6e75baacbc0df0cd1742)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159908
Tested-by: Jenkins
This commit is contained in:
Gökay Şatır
2023-11-28 14:28:42 +01:00
committed by Mike Kaganski
parent 708e52a551
commit 7697ef9d8f
+2 -1
View File
@@ -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;