editeng/source/misc/svxacorr.cxx |   40 +++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 665379874b65e963b8ebc39623dc25ffe5510a3c
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue Sep 30 01:02:43 2025 +0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Sep 30 11:14:11 2025 +0200

    tdf#96787 tdf#168603 Skip primary language list, when country-specific found
    
    ... but don't skip the [All] (LANGUAGE_UNDETERMINED) list. See bug 141773
    and commits ae56dc05b27f05ffcee99845d661a237e70a7a51 (tdf#96787: 
AutoCorrect:
    after deleting a replacement entry, it's still used, 2021-01-10) and
    50be3fa1f0f3b8870af5bda88b65f835ef37d77e (tdf#141773 AutoCorrect: fix broken
    [All] dictionaries, 2024-06-29).
    
    A separate issue is that the languags list in autocorrect options now lists
    [Multiple] and [Undetermined], which shouldn't be there (the latter is the
    same as [All]). It needs an own bug and a separate fix.
    
    Change-Id: I1de8879c892efec23ce976b9e450088a22fdd652
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191643
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit a25c152abb31db437eb306f358ae71ab73d2e6ba)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191651
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 1453f9f91921..4cfbf716453b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2066,28 +2066,32 @@ SvxAutoCorrect::SearchWordsInList(
             return pRet;
         }
     }
-
-    // If it still could not be found here, then keep on searching
-    LanguageType eLang = aLanguageTag.getLanguageType();
-    // the primary language for example EN
-    aLanguageTag.reset(aLanguageTag.getLanguage());
-    LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
-    if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
-                (m_aLangTable.find(aLanguageTag) != m_aLangTable.end() ||
-                 CreateLanguageFile(aLanguageTag, false)))
+    else
     {
-        //the language is available - so bring it on
-        const auto iter = m_aLangTable.find(aLanguageTag);
-        assert(iter != m_aLangTable.end());
-        SvxAutoCorrectLanguageLists& rList = iter->second;
-        auto pRet = lcl_SearchWordsInList( &rList, rTxt, rStt, nEndPos );
-        if( pRet )
-        {
-            rLang = aLanguageTag;
-            return pRet;
+        // If the specific language's list wasn't found, keep on searching
+        LanguageType eLang = aLanguageTag.getLanguageType();
+        // the primary language for example EN
+        aLanguageTag.reset(aLanguageTag.getLanguage());
+        LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
+        if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED
+            && (m_aLangTable.find(aLanguageTag) != m_aLangTable.end()
+                || CreateLanguageFile(aLanguageTag, false)))
+        {
+            //the language is available - so bring it on
+            const auto iter = m_aLangTable.find(aLanguageTag);
+            assert(iter != m_aLangTable.end());
+            SvxAutoCorrectLanguageLists& rList = iter->second;
+            auto pRet = lcl_SearchWordsInList(&rList, rTxt, rStt, nEndPos);
+            if (pRet)
+            {
+                rLang = aLanguageTag;
+                return pRet;
+            }
         }
     }
 
+    // This is the [All] entry in AutoCorrect Options' replacement language 
list, used with all
+    // languages, so don't skip when language-specific list didn't contain the 
text:
     if (m_aLangTable.find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != 
m_aLangTable.end() ||
             CreateLanguageFile(aLanguageTag, false))
     {

Reply via email to