<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span> changed
<a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - AutoCorrect: After Removal of Replacement Entry the Replacement Itself is still Performed."
href="https://bugs.documentfoundation.org/show_bug.cgi?id=96787">bug 96787</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>ASSIGNED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>dirk.wun@t-online.de, serval2412@yahoo.fr
</td>
</tr>
<tr>
<td style="text-align:right;">Assignee</td>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
<td>serval2412@yahoo.fr
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - AutoCorrect: After Removal of Replacement Entry the Replacement Itself is still Performed."
href="https://bugs.documentfoundation.org/show_bug.cgi?id=96787#c21">Comment # 21</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - AutoCorrect: After Removal of Replacement Entry the Replacement Itself is still Performed."
href="https://bugs.documentfoundation.org/show_bug.cgi?id=96787">bug 96787</a>
from <span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span></b>
<pre>On pc Debian x86-64 with master sources updated today, I could reproduce this.
I tried with the example of <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED WONTFIX - AutoCorrect in LO-Writer changes as from version 7.0.4.1 forcibly “daß” (traditional German spelling rules) to “dass” (reformed German spelling rules)"
href="show_bug.cgi?id=139377">tdf#139377</a> where Dirk (I put in cc) would like to
avoid LO from replacing "daß" by "dass".
After deleting the entry, LO still does the replacement even after having
restarted LO.
If we take the example of German language from Germany, the initial replacement
file (ie with a brand new LO profile) is "acor_de.dat" present in "share"
directory.
Just for information, these dat files are in fact zip files with a specific
structure, see:
julien@debianamd:/tmp/test$ ls
acor_de.dat
julien@debianamd:/tmp/test$ mv acor_de.dat acor_de.zip
julien@debianamd:/tmp/test$ unzip acor_de.zip
Archive: acor_de.zip
extracting: mimetype
inflating: DocumentList.xml
inflating: META-INF/manifest.xml
inflating: SentenceExceptList.xml
inflating: WordExceptList.xml
When deleting an entry in the autocorrect dialog and click Ok, LO generates
a "acor_de-DE.dat" in "user" directory this time.
This "acor_de-DE.dat" contains all the replacements from "acor_de.dat" except
the deleted entry.
Important thing to note: "acor_de.dat" in "share" doesn't change and still
contains all replacements (included "daß"=>"dass")
Remark: the extra "-DE" in the file name is because I used Germany locale. If I
switch to Austria locale for example, it will use initial "acor_de.dat" from
"share" so it won't use "acor_de-DE.dat" from "user" directory)
After some debugging, I noticed that the type of replacement "daß"->"dass" was
done in SvxAutoCorrect::SearchWordsInList
(see
<a href="https://opengrok.libreoffice.org/xref/core/editeng/source/misc/svxacorr.cxx?r=40e98c87#1920">https://opengrok.libreoffice.org/xref/core/editeng/source/misc/svxacorr.cxx?r=40e98c87#1920</a>).
1) it begins in the block:
1932 // First search for eLang, then US-English -> English
1933 // and last in LANGUAGE_UNDETERMINED
1934 if (m_aLangTable.find(aLanguageTag) != m_aLangTable.end() ||
CreateLanguageFile(aLanguageTag, false))
1935 {
1936 //the language is available - so bring it on
1937 std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList =
m_aLangTable.find(aLanguageTag)->second;
1938 pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos
);
1939 if( pRet )
1940 {
1941 rLang = aLanguageTag;
1942 return pRet;
1943 }
1944 }
gdb showed that pList.get() used "acor_de-DE.dat" (from "user") and when
searching "daß", it doesn't enter if block at line 1939 as expected.
2) But then LO keeps in the next block:
1946 // If it still could not be found here, then keep on searching
1947 LanguageType eLang = aLanguageTag.getLanguageType();
1948 // the primary language for example EN
1949 aLanguageTag.reset(aLanguageTag.getLanguage());
1950 LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
1951 if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
1952 (m_aLangTable.find(aLanguageTag) != m_aLangTable.end()
||
1953 CreateLanguageFile(aLanguageTag, false)))
1954 {
1955 //the language is available - so bring it on
1956 std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList =
m_aLangTable.find(aLanguageTag)->second;
1957 pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos
);
1958 if( pRet )
1959 {
1960 rLang = aLanguageTag;
1961 return pRet;
1962 }
1963 }
and here pList.get() shows "acor_de.dat" from "share".
So when searching "daß", it finds the replace (since "acor_de.dat" isn't
changed when deleting an entry)
I'm gonna propose this straightforward patch:
diff --git a/editeng/source/misc/svxacorr.cxx
b/editeng/source/misc/svxacorr.cxx
index ae6dceb33adf..0f048114462b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1941,6 +1941,8 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
rLang = aLanguageTag;
return pRet;
}
+ else
+ return nullptr;
}
// If it still could not be found here, then keep on searching
If a correspond acor file is found in user, it goes into 1) like previously but
instead of keeping on with 2), if there's no replacement found, it returns
nullptr.
I tested this patch with a brand new LO profile (so without "acor_de-DE.dat"),
the replacement works since we don't enter the first if of 1) and so we go into
2).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>