diff options
author | Mattias Johnsson <m.t.johnsson@gmail.com> | 2010-11-28 13:37:12 +1100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-12-01 14:17:04 +0100 |
commit | cda75d6f358d438f7ed36ed7fa296ac23e3c4a04 (patch) | |
tree | a251db7eac48700504ba2239614cb80c321de69a /sw | |
parent | ad215b94ecc372fe56502dcb021cabe3cb5e9f07 (diff) |
Fix for i#8288: "Replace all" should leave the cursor at original position
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/uiview/viewsrch.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index fa483123f074..b01fbb1ca16b 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 ) { |