[Libreoffice-commits] core.git: sw/qa sw/source

Nickson Thanda nicksonthanda10 at msn.com
Mon Jul 2 07:32:50 UTC 2018


 sw/qa/extras/uiwriter/uiwriter.cxx |   15 +++++++++++++++
 sw/source/core/edit/autofmt.cxx    |    8 ++++++++
 sw/source/uibase/docvw/edtwin.cxx  |    3 +--
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 391134e4cc0cf444ac50c6df02073de57ad9c466
Author: Nickson Thanda <nicksonthanda10 at msn.com>
Date:   Fri Jun 22 04:59:16 2018 +0100

    tdf#51223 can now undo auto-capitalise with enter
    
    Change-Id: I1ff1bd0137415349d1eb89bef0947453f72a8ef5
    Reviewed-on: https://gerrit.libreoffice.org/56267
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e6ab7cdaf515..3dc0e7a233ea 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -345,6 +345,7 @@ public:
     void testTdf116789();
     void testTdf117225();
     void testTdf91801();
+    void testTdf51223();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -541,6 +542,7 @@ public:
     CPPUNIT_TEST(testTdf116789);
     CPPUNIT_TEST(testTdf117225);
     CPPUNIT_TEST(testTdf91801);
+    CPPUNIT_TEST(testTdf51223);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -6311,6 +6313,19 @@ void SwUiWriterTest::testTdf91801()
     CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue());
 }
 
+void SwUiWriterTest::testTdf51223()
+{
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+    pWrtShell->Insert("i");
+    pWrtShell->SplitNode(true);
+    CPPUNIT_ASSERT_EQUAL(OUString("I"), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
+    rUndoManager.Undo();
+    CPPUNIT_ASSERT_EQUAL(OUString("i"), static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
+
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 19dff285050c..33a41866af1a 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2611,6 +2611,14 @@ void SwEditShell::AutoFormatBySplitNode()
 
         SwAutoFormat aFormat( this, aAFFlags, &pCursor->GetMark()->nNode,
                                 &pCursor->GetPoint()->nNode );
+        SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get().GetAutoCorrect();
+        if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
+                                ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber |
+                                ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr | ACFlags::Autocorrect ))
+            pACorr = nullptr;
+
+        if( pACorr )
+            AutoCorrect( *pACorr,false, u'\0' );
 
         //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor!
         Pop(PopMode::DeleteCurrent);
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 09f2794b067e..bbf7c8400dd6 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1851,8 +1851,7 @@ KEYINPUT_CHECKTABLE:
                                     SelectionType::TableCell | SelectionType::DrawObject |
                                     SelectionType::DrawObjectEditMode)) )
                         {
-                            eKeyState = SwKeyState::CheckAutoCorrect;
-                            eNextKeyState = SwKeyState::AutoFormatByInput;
+                            eKeyState = SwKeyState::AutoFormatByInput;
                         }
                         else
                         {


More information about the Libreoffice-commits mailing list