[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - editeng/source sw/qa

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 22 13:44:47 UTC 2021


 editeng/source/misc/svxacorr.cxx   |    5 ++++-
 sw/qa/extras/uiwriter/uiwriter.cxx |   10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit c4c0414eac8e2cdf4bebc6808224f154d2d6e298
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Feb 25 10:55:57 2021 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Apr 22 15:44:16 2021 +0200

    tdf#134940 sw: fix AutoCorrect of arrow "-->"
    
    Fix bad replacement of "-->" with "–>" instead of "→"
    (i.e. premature replacement of "--" to n-dash)
    since '>' was added to IsAutoCorrectChar().
    
    Regression from commit 57f07b1d7378d218648667c5b1315cc8ad905875
    "tdf#133524 AutoCorrect: support double angle quotes".
    
    Change-Id: I06f0cddb48d13c8e230dab964f79f588799ed4ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111527
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit d1be3d80d0ca5ccd7639ede379a1befc48dc73f2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111580
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 472e2e08480d04ac9cc1c9ddcb5862bc2f1d8660)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114495
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index df6e8985e11e..845f11acaa28 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1517,7 +1517,10 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
         if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nInsPos ))
             break;
 
-        if( IsAutoCorrFlag( ACFlags::Autocorrect ) )
+        if( IsAutoCorrFlag( ACFlags::Autocorrect ) &&
+            // tdf#134940 fix regression of arrow "-->" resulted by premature
+            // replacement of "--" since '>' was added to IsAutoCorrectChar()
+            '>' != cChar )
         {
             // WARNING ATTENTION: rTxt is an alias of the text node's OUString
             // and becomes INVALID if ChgAutoCorrWord returns true!
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 7517dc825a10..8d2cd669630d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7683,6 +7683,16 @@ void SwUiWriterTest::testTdf133524()
     pWrtShell->AutoCorrect(corr, '"');
     sReplaced += u".”";
     CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
+    // tdf#134940 avoid premature replacement of "--" in "-->"
+    pWrtShell->Insert(u" --");
+    pWrtShell->AutoCorrect(corr, '>');
+    OUString sReplaced2(sReplaced + u" -->");
+    // This was "–>" instead of "-->"
+    CPPUNIT_ASSERT_EQUAL(sReplaced2, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
+    pWrtShell->AutoCorrect(corr, ' ');
+    sReplaced += u" → ";
+    // This was "–>" instead of "→"
+    CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
 }
 
 void SwUiWriterTest::testTdf133524_Romanian()


More information about the Libreoffice-commits mailing list