sw/source/core/doc/DocumentContentOperationsManager.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4f93995f2262cde0b16bacc83f4ba3c6161ada7f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun May 7 17:11:21 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun May 7 19:53:27 2023 +0200

    tdf#137972: when correcting PaMs, move them to the end
    
    The cursor position is pushed in SwView::ExecSpellPopup, and popped
    in the end, to restore the changed position e.g. when the action is
    cancelled.
    
    In the replacement, the PaM of the pushed cursor is updated in
    DocumentContentOperationsManager::ReplaceRangeImpl, likely to avoid
    several updates during the further processing. The stated goal is
    to move all PaMs out of the deleted range, but the direction is not
    stated explicitly.
    
    If this correction is removed, the cursor PaM gets corrected anyway,
    and arrives at the end of the replaced text. So, to fix the bug, and
    to be compliant with the default case, let's correct to the end of
    the range, instead of the random direction (GetPoint() may return a
    position at either end, depending how PaM was created).
    
    Change-Id: I83bcf01bcc0bf7277a9a34263b524b1212785814
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151462
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 3a158e26a9a1..373532db1eab 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4480,7 +4480,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
         // the other views out of the deletion range.
         // Except for itself!
         SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
-        ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
+        ::PaMCorrAbs( aDelPam, *aDelPam.End() );
 
         auto [pStt, pEnd] = aDelPam.StartEnd(); // SwPosition*
         bool bOneNode = pStt->GetNode() == pEnd->GetNode();

Reply via email to