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

New commits:
commit f43dfd0c7fa44eefac75ba7050debb238697d98e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Sep 19 21:18:52 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Sep 21 08:16:50 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 <michael.st...@allotropia.de>
    (cherry picked from commit b20ca8d951e8205c8b963c6b7407f984053b4094)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157110
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4d69e2a6d705..84f0ba59072a 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1785,8 +1785,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()
@@ -1798,7 +1798,7 @@ void SwCursorShell::UpdateCursorPos()
 
     if (isInHiddenTextFrame(pShellCursor) && !ExtendedSelectedAll())
     {
-        SwCursorMoveState aTmpState( CursorMoveState::NONE );
+        SwCursorMoveState aTmpState(CursorMoveState::SetOnlyText);
         aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
         GetLayout()->GetModelPositionForViewPoint( pShellCursor->GetPoint(), 
pShellCursor->GetPtPos(),
                                      &aTmpState );

Reply via email to