diff options
author | Michael Warner <michael.warner.ut+libreoffice@gmail.com> | 2022-02-13 22:45:48 -0500 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-17 17:15:16 +0100 |
commit | b7308bda7212da5681b7047c02e2e13e36b2a98a (patch) | |
tree | adc0fea3b951fb5fda1439dc6e1741e716684aed /sw | |
parent | 957d99a539df6e21fd40370938ca5dab1613cf8c (diff) |
tdf#147196: Fix crash in editeng when applying title case format
Fixes a possiblity of crashing when applying title case format using the
edit engine.
Change-Id: I4f44f635a1c96b021c084bb5bb973180744e56e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129888
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 34 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 3 |
2 files changed, 34 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 6b0724eae54e..55b079756de0 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -322,6 +322,40 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf49033) lcl_translitTest(*pDoc, *pCursor, TF::UPPERCASE_LOWERCASE)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147196) +{ + using TF = TransliterationFlags; + SwDoc* pDoc = createSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // Insert the test text at the end of the document. + pWrtShell->SttEndDoc(/*bStt=*/false); + pWrtShell->Insert( + "2.2 Publication of information - CAA\nSection 4.2 of a CA\'s Certificate Policy and/or " + "Certification Practice Statement SHALL state the CA\'s policy or practice on processing " + "CAA Records for Fully Qualified Domain Names; that policy shall be consistent with these " + "Requirements. \n\nIt shall clearly specify the set of Issuer Domain Names that the CA " + "recognises in CAA \"issue\" or \"issuewild\" records as permitting it to issue. The CA " + "SHALL log all actions taken, if any, consistent with its processing practice."); + + pWrtShell->StartOfSection(); + SwShellCursor* pCursor = pWrtShell->getShellCursor(false); + pCursor->SetMark(); + for (int i = 0; i < 510; i++) + { + pCursor->Move(fnMoveForward); + } + CPPUNIT_ASSERT_EQUAL( + OUString("2.2 Publication Of Information - Caa\nSection 4.2 Of A Ca\'s Certificate Policy " + "And/Or Certification Practice Statement Shall State The Ca\'s Policy Or Practice " + "On Processing Caa Records For Fully Qualified Domain Names; That Policy Shall Be " + "Consistent With These Requirements. \n\nIt Shall Clearly Specify The Set Of " + "Issuer Domain Names That The Ca Recognises In Caa \"Issue\" Or \"Issuewild\" " + "Records As Permitting It To Issue. The Ca Shall Log All Actions Taken, If Any, " + "Consistent With Its Processing Practice."), + lcl_translitTest(*pDoc, *pCursor, TF::TITLE_CASE)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96943) { // Enable hide whitespace mode. diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 1ed69cb78265..28b633755a7d 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1789,9 +1789,6 @@ void SwTextNode::TransliterateText( GetText(), nStt, g_pBreakIt->GetLocale(GetLang(nStt, 1)), nWordType); - - /* Selection may end in the middle of a word */ - aCurWordBndry.endPos = std::min(aCurWordBndry.endPos, selEnd); } } else if (rTrans.getType() == TransliterationFlags::SENTENCE_CASE) |