[Libreoffice-commits] .: sw/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Wed Dec 1 05:23:31 PST 2010
sw/source/ui/uiview/viewsrch.cxx | 9 +++++++++
1 file changed, 9 insertions(+)
New commits:
commit 7ad2899f3cd4d58cd73506f3534999b076147cf1
Author: Mattias Johnsson <m.t.johnsson at gmail.com>
Date: Sun Nov 28 13:37:12 2010 +1100
Fix for i#8288: "Replace all" should leave the cursor at original position
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index b85816d..a230405 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -286,6 +286,10 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
{
SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
+ // Fix for i#8288: "Replace all" should leave the cursor at the place it was
+ // before executing the command, rather than at the site of the final replacement.
+ // To do this take note of the current cursor position before replace all begins:
+ SwPosition TmpPointPos = *pWrtShell->GetSwCrsr()->GetPoint();
if( !pSrchItem->GetSelection() )
{
@@ -305,8 +309,13 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
SwWait aWait( *GetDocShell(), TRUE );
pWrtShell->StartAllAction();
nFound = FUNC_Search( aOpts );
+
+ // i#8288: Now that everything has been replaced, restore the original cursor position.
+ *(pWrtShell->GetSwCrsr()->GetPoint()) = TmpPointPos;
+
pWrtShell->EndAllAction();
}
+
rReq.SetReturnValue(SfxBoolItem(nSlot, nFound != 0 && ULONG_MAX != nFound));
if( !nFound )
{
More information about the Libreoffice-commits
mailing list