summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter7.cxx5
-rw-r--r--sw/source/core/crsr/findtxt.cxx19
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx
index bf9a4ee1bd1c..dda894b7fda5 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -386,6 +386,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch)
xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
// should actually be 10 (including the empty para with the comment marker, and the last para)
CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+
+ xSearchDes->setSearchString(".$"); // any last character (not just full-stops) in a paragraph
+ xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+ // should be one for every non-empty paragraph
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 930ac7926ce2..34d16d2a91b9 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -726,6 +726,25 @@ bool DoSearch(SwPaM & rSearchPam,
SwTextNode const*const pNode, SwTextFrame const*const pFrame,
SwRootFrame const*const pLayout, SwPaM& rPam)
{
+ if (bRegSearch && rSearchOpt.searchString.endsWith("$"))
+ {
+ bool bAlwaysSearchingForEndOfPara = true;
+ sal_Int32 nIndex = 0;
+ while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1)
+ {
+ if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$')
+ {
+ bAlwaysSearchingForEndOfPara = false;
+ break;
+ }
+ ++nIndex;
+ }
+ // when searching for something at the end of the paragraph, the para end must be in range
+ const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart;
+ if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != rParaEnd.GetAnyIndex())
+ return false;
+ }
+
bool bFound = false;
OUString sCleanStr;
std::vector<AmbiguousIndex> aFltArr;