[Libreoffice-commits] core.git: sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 6 23:59:15 UTC 2019


 sw/source/uibase/wrtsh/select.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 25c390e17a7f1c018b5eed1ef7dfd568b76f4a84
Author:     Jim Raykowski <raykowj at gmail..com>
AuthorDate: Sat Nov 2 12:51:36 2019 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Nov 7 00:57:48 2019 +0100

    tdf#38199 Readonly mode tab key: Don't scroll if no hyperlink found
    
    When viewing a document in readonly mode the action of the tab key is to
    move among Graphic, Frame, Ole, DrawObject, or DbForm if one these is
    already selected. If the cursor is inside an input field and has no multi
    selection then move among InputFields. Finally if neither the previous
    two cases apply then move among Hyperlinks which causes cursor position
    to move to top or bottom of the document when no Hyperlink is found.
    When no Hyperlink is found this patch restores the cursor position to
    the position before search and does not scroll to it on EndAction.
    
    Change-Id: I94ac882e7be124d2ddb6f86daac03a9389117cc5
    Reviewed-on: https://gerrit.libreoffice.org/81955
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index e06f3dc69777..90664ae098f5 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -941,15 +941,22 @@ void SwWrtShell::SelectNextPrevHyperlink( bool bNext )
 {
     StartAction();
     bool bRet = SwCursorShell::SelectNxtPrvHyperlink( bNext );
-    if( !bRet )
+    if( !bRet ) // didn't find? wrap and check again
     {
-        // will we have this feature?
+        SwShellCursor* pCursor = GetCursor_();
+        SwCursorSaveState aSaveState(*pCursor);
         EnterStdMode();
         if( bNext )
             SttEndDoc(true);
         else
             SttEndDoc(false);
-        SwCursorShell::SelectNxtPrvHyperlink( bNext );
+        bRet = SwCursorShell::SelectNxtPrvHyperlink(bNext);
+        if (!bRet) // didn't find again? restore cursor position and bail
+        {
+            pCursor->RestoreSavePos();
+            EndAction(true); // don't scroll to restored cursor position
+            return;
+        }
     }
     EndAction();
 


More information about the Libreoffice-commits mailing list