sw/source/core/crsr/crstrvl.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 3fefff7ce29a234694343105c50c7bc3259a9cb8
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jan 12 12:52:51 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jan 12 15:13:21 2024 +0100

    tdf#158783 sw: SwCursorShell::GotoTOXMark() must actually move cursor
    
    The problem was that the buttons in SwIndexMarkPane got the
    next/previous mark, but SwCursorShell::GotoTOXMark() may return the
    next/previous mark without actually moving the cursor.
    
    It happens that the current mark is outside a table and the next mark is
    inside a table, then UpdateCursor() doesn't accept the invalid cursor
    range and resets the point to its previous position.
    
    Change-Id: I5c0fb4a9bbcbdd479581172834b6eda76a5abbc1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161970
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 00c1c2e61c6d..e934cd1a8686 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -602,6 +602,7 @@ const SwTOXMark& SwCursorShell::GotoTOXMark( const 
SwTOXMark& rStart,
     SwPosition& rPos = *GetCursor()->GetPoint();
     rPos.Assign(rNewMark.GetTextTOXMark()->GetTextNode(),
                  rNewMark.GetTextTOXMark()->GetStart() );
+    GetCursor()->DeleteMark(); // tdf#158783 prevent UpdateCursor resetting 
point
 
     if( !m_pCurrentCursor->IsSelOvr() )
         UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE |

Reply via email to