sw/source/uibase/shells/navsh.cxx   |   15 ++++++++-------
 sw/source/uibase/uiview/viewmdi.cxx |   19 ++++++++++++++++---
 2 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 55ad7b09312e5862c17104832175924feafe7ad3
Author:     Jim Raykowski <[email protected]>
AuthorDate: Mon Nov 17 22:37:56 2025 -0900
Commit:     Jim Raykowski <[email protected]>
CommitDate: Tue Dec 2 09:57:27 2025 +0100

    tdf#169480 Enhancement to recency navigation
    
    Enhancement request for special handling for situations when a user
    has scrolled/moved the view so that the cursor is no longer visible.
    To handle this, recency navigation should check if the cursor is in
    the view and if not, then scroll/move the view to make the cursor
    visible without any manipulation of the back/forward stack.
    
    Change-Id: Iaaa2b09108649ed12183dcc75b9bb03a7915458c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194147
    Tested-by: Jenkins
    Reviewed-by: Vernon, Stuart Foote <[email protected]>
    Reviewed-by: Jim Raykowski <[email protected]>

diff --git a/sw/source/uibase/shells/navsh.cxx 
b/sw/source/uibase/shells/navsh.cxx
index feebd98586ca..c970da2d2076 100644
--- a/sw/source/uibase/shells/navsh.cxx
+++ b/sw/source/uibase/shells/navsh.cxx
@@ -42,19 +42,20 @@ void SwNavigationShell::Execute(SfxRequest const& rReq)
     if (pArgs)
         pArgs->GetItemState(nSlotId, false, &pItem);
 
-    if (pSdrView->IsTextEdit())
-        pSh->EndTextEdit();
-    if (pSh->GetView().IsDrawMode())
-        pSh->GetView().LeaveDrawCreate();
-    pSh->EnterStdMode();
-
     switch (nSlotId)
     {
         case FN_NAVIGATION_BACK:
-            aSwNavigationMgr.goBack();
+            if (pSh->IsCursorVisible())
+            {
+                pSh->EnterStdMode();
+                aSwNavigationMgr.goBack();
+            }
+            else
+                pSh->UpdateCursor(SwCursorShell::SCROLLWIN);
             break;
 
         case FN_NAVIGATION_FORWARD:
+            pSh->EnterStdMode();
             aSwNavigationMgr.goForward();
             break;
         default:
diff --git a/sw/source/uibase/uiview/viewmdi.cxx 
b/sw/source/uibase/uiview/viewmdi.cxx
index 9421eae0bfe9..24b55ca906d4 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -624,9 +624,22 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
             rSh.GotoNxtPrvTableFormula( bNext, true );
             break;
 
-        case NID_RECENCY :
-            rSh.EnterStdMode();
-            bNext ? rSh.GetNavigationMgr().goForward() : 
rSh.GetNavigationMgr().goBack();
+        case NID_RECENCY:
+            if (bNext)
+            {
+                rSh.EnterStdMode();
+                rSh.GetNavigationMgr().goForward();
+            }
+            else
+            {
+                if (rSh.IsCursorVisible())
+                {
+                    rSh.EnterStdMode();
+                    rSh.GetNavigationMgr().goBack();
+                }
+                else
+                    rSh.UpdateCursor(SwCursorShell::SCROLLWIN);
+            }
             break;
     }
     if (NID_POSTIT != s_nMoveType)

Reply via email to