[PATCH] Fix backwards/forwards search change of direction.
Andrzej J.R. Hunt (via Code Review)
gerrit at gerrit.libreoffice.org
Mon May 27 11:12:33 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4061
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/61/4061/1
Fix backwards/forwards search change of direction.
Begin a search from the extremity of the selected region instead of from the
cursor position. Previously when changing search direction the first
"result" is the same as has been previously found when searching forwards as
the cursor is at the end of the selection, and the search region is from the
end of the previous result to the begin of the document. Now the selected
or previously found region is ignored.
Change-Id: I65a5d94b898dd4b7467889b1932f42c9b6b523fe
---
M sw/source/ui/uiview/viewsrch.cxx
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index fce4d50..2049564 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -444,6 +444,24 @@
// aus 'Suche alle'
m_pWrtShell->StartAllAction();
m_pWrtShell->Push();
+
+ // Move the cursor to the front/back of selected areas to avoid searching
+ // through the selected area when doing a normal search.
+ SwPaM* pCrsr = m_pWrtShell->GetCrsr();
+ SwPaM* pStartCrsr = pCrsr;
+ SwPosition* pStart =( *pCrsr->GetPoint() < *pCrsr->GetMark() ) ?
+ pCrsr->GetPoint() : pCrsr->GetMark();
+ SwPosition* pEnd = ( *pCrsr->GetPoint() < *pCrsr->GetMark() ) ?
+ pCrsr->GetMark() : pCrsr->GetPoint();
+ while ( ( pCrsr = ( SwPaM* ) pCrsr->GetNext() ) != pStartCrsr );
+ {
+ pStart = ( *pCrsr->GetPoint() < *pStart ) ? pCrsr->GetPoint() : pStart;
+ pStart = ( *pCrsr->GetMark() < *pStart ) ? pCrsr->GetMark() : pStart;
+ pEnd = ( *pCrsr->GetPoint() > *pEnd ) ? pCrsr->GetPoint() : pEnd;
+ pEnd = ( *pCrsr->GetMark() > *pEnd ) ? pCrsr->GetMark() : pEnd;
+ }
+ *pStartCrsr->GetPoint() = m_pSrchItem->GetBackward() ? *pStart : *pEnd;
+
// falls in selektierten Bereichen gesucht werden soll, duerfen sie
// nicht aufgehoben werden
if (!m_pSrchItem->GetSelection())
--
To view, visit https://gerrit.libreoffice.org/4061
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65a5d94b898dd4b7467889b1932f42c9b6b523fe
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Andrzej J.R. Hunt <andrzej at ahunt.org>
More information about the LibreOffice
mailing list