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

New commits:
commit a25c152abb31db437eb306f358ae71ab73d2e6ba
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue Sep 30 01:02:43 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Sep 29 23:20: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]>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 59c34e6f9175..c03328447b71 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2064,28 +2064,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