sw/source/core/crsr/crsrsh.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 68310c73c1755d2e8a4d6f80084ef3d6b7a1d10e
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Sep 19 21:18:52 2023 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Sep 20 10:03:10 2023 +0200

    tdf#157129 sw: fix wrong cursor position after paste
    
    This asserts in SwUndoInserts::UndoImpl():
    index.cxx:234: virtual SwContentIndexReg::~SwContentIndexReg(): Assertion 
`!m_pFirst && !m_pLast && "There are still indices registered"' failed.
    
    Because there is a bookmark still registered, because the content was
    inserted wrongly into a fly frame that contains a SwGrfNode, because
    earlier the cursor was in a hidden text node and
    SwCursorShell::UpdateCursorPos() moved it into an as-char anchored image.
    
    UpdateCursorPos() should put the cursor only onto a text node.
    
    (somehow regression from commit bb733957dd39e6f0b9d80bb59eb0177188794797)
    
    Change-Id: If00d1e09a612849a44bb3e2d3bd7bac6fa9ac05f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157071
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit b20ca8d951e8205c8b963c6b7407f984053b4094)

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index bec74a32816e..e58821c60808 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1751,8 +1751,8 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
 
 /** Set the cursor back into content.
 
-    This should only be called if the cursor was move somewhere else (e.g. when
-    deleting a border). The new position is calculated from its current 
position
+    This should only be called if the cursor was moved (e.g. when deleting a
+    text frame). The new position is calculated from its current position
     in the layout.
 */
 void SwCursorShell::UpdateCursorPos()
@@ -1764,7 +1764,7 @@ void SwCursorShell::UpdateCursorPos()
 
     if (isInHiddenTextFrame(pShellCursor) && !ExtendedSelectedAll())
     {
-        SwCursorMoveState aTmpState( MV_NONE );
+        SwCursorMoveState aTmpState(MV_SETONLYTEXT);
         aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
         GetLayout()->GetCursorOfst( pShellCursor->GetPoint(), 
pShellCursor->GetPtPos(),
                                      &aTmpState );

Reply via email to