sw/source/uibase/uiview/viewsrch.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 9a7d9366125374df07f6a0369a96ee2978f7f24c
Author:     Martin van Zijl <martin.vanz...@gmail.com>
AuthorDate: Mon Dec 17 13:06:26 2018 +1300
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Fri Feb 1 08:32:55 2019 +0100

    tdf#44837 fix bug where replace all clears selection
    
    Change-Id: I3b1c95439434fab55ffd159dce0aacded4551a07
    Reviewed-on: https://gerrit.libreoffice.org/65291
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 94eb878621ef..70b2bd98cf56 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -358,13 +358,15 @@ void SwView::ExecSearch(SfxRequest& rReq)
                     {   //Scope for SwWait-Object
                         SwWait aWait( *GetDocShell(), true );
                         m_pWrtShell->StartAllAction();
+
+                        // i#8288 "replace all" should not change cursor
+                        // position, so save current cursor
+                        m_pWrtShell->Push();
+
                         if (!m_pSrchItem->GetSelection())
                         {
                             // if we don't want to search in the selection...
                             m_pWrtShell->KillSelection(nullptr, false);
-                            // i#8288 "replace all" should not change cursor
-                            // position, so save current cursor
-                            m_pWrtShell->Push();
                             if (SwDocPositions::Start == aOpts.eEnd)
                             {
                                 m_pWrtShell->EndOfSection();
@@ -375,13 +377,10 @@ void SwView::ExecSearch(SfxRequest& rReq)
                             }
                         }
                         nFound = FUNC_Search( aOpts );
-                        if (!m_pSrchItem->GetSelection())
-                        {
-                            // create it just to overwrite it with stack cursor
-                            m_pWrtShell->CreateCursor();
-                            // i#8288 restore the original cursor position
-                            
m_pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent);
-                        }
+                        // create it just to overwrite it with stack cursor
+                         m_pWrtShell->CreateCursor();
+                        // i#8288 restore the original cursor position
+                        
m_pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent);
                         m_pWrtShell->EndAllAction();
                     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to