diff options
author | Nickson Thanda <nicksonthanda10@msn.com> | 2018-06-22 04:59:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-07-02 09:32:29 +0200 |
commit | 391134e4cc0cf444ac50c6df02073de57ad9c466 (patch) | |
tree | 4a4c32f9054606ff96789e278bdc6bdd79711832 | |
parent | f54143088a867c59be144f1d4d7cd6d9fe1c18f5 (diff) |
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@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 3 |
3 files changed, 24 insertions, 2 deletions
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 { |