sw/source/uibase/wrtsh/wrtsh1.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 72b69aa86c69f4d40720d62ecc24a2b004e0d1b8
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Jan 23 15:20:36 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Jan 25 20:21:19 2023 +0000

    sw: check for control before cursor pos on WrtShell ctor
    
    It may be entirely possible that WrtShell always starts
    with the current cursor at the beginning,
    but it certainly shouldn't hurt to at least attempt to
    look prior to whatever the cursor is when it starts up.
    
    I just created the ability for getFieldmarkAfter
    to loop around to the beginning, but I kept this
    code the same initially to avoid sullying the basic patch
    in case these particular lines somehow do bad things.
    
    But /*bloop=*/true seem more appropriate to the intent
    of this function than a false would. If we are in form
    mode, do anything possible to get into a fieldmark.
    
    Of course, we also have activeX controls
    and content controls, so perhaps this needs a bit
    of expansion to handle those as well...
    
    Change-Id: I8a6ec499e3d88203e036baa9b4eada5592fcd815
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146047
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index ab5882a1147b..a13cda9bb3d3 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2002,7 +2002,7 @@ SwWrtShell::SwWrtShell( SwWrtShell& rSh, vcl::Window 
*_pWin, SwView &rShell )
 
     // place the cursor on the first field...
     IFieldmark *pBM = nullptr;
-    if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/false)) 
!=nullptr) {
+    if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) 
!=nullptr) {
         GotoFieldmark(pBM);
     }
 }
@@ -2020,7 +2020,7 @@ SwWrtShell::SwWrtShell( SwDoc& rDoc, vcl::Window *_pWin, 
SwView &rShell,
 
     // place the cursor on the first field...
     IFieldmark *pBM = nullptr;
-    if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/false)) 
!=nullptr) {
+    if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) 
!=nullptr) {
         GotoFieldmark(pBM);
     }
 }

Reply via email to