[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 18:51:32 UTC 2020


 sw/source/core/doc/DocumentContentOperationsManager.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 92dbbf840c1da7628bcdd9e8f67375efc2a2fa14
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jun 19 16:32:19 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Jun 19 20:50:58 2020 +0200

    tdf#127635 sw_redlinehide: put point at the end of deletion
    
    SwWrtShell::Insert() is called with a selection, so it first calls
    DeleteAndJoin() to get rid of the selection.
    
    With redlining enabled, this leaves the cursor as it was before, so if
    the point was at the start it still is at the start, so the following
    Insert will insert at the start of the selection.
    
    But then AutoCorrect wants to do things and it uses TextFrameIndex and
    ViewToModelPos and gets a result at the end of the delete redline,
    while the cursor remains at the start of the delete redline.
    
    Avoid this by swapping the selection after DeleteAndJoin() (and also
    DeleteRange() for consistency) so that insertion happens at end of
    redline (swap "above" DoWithBreaks because it creates temporary PaMs).
    
    (regression from sw_redlinehide)
    
    Change-Id: Ib5b0475f610c2ce426e9202e9d325dd0cc451d5c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96743
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 398ba26077f9029bdf6f7378bfc9ce8376b6f02d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96704

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index dc262426ff1e..6d048e248c3c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2008,6 +2008,11 @@ void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam )
 {
     lcl_DoWithBreaks( *this, rPam, &DocumentContentOperationsManager::DeleteRangeImpl );
 
+    if (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+    {
+        rPam.Normalize(false); // tdf#127635 put point at the end of deletion
+    }
+
     if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline()
         && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty())
     {
@@ -2179,10 +2184,17 @@ bool DocumentContentOperationsManager::DeleteAndJoin( SwPaM & rPam,
     if ( lcl_StrLenOverflow( rPam ) )
         return false;
 
-    return lcl_DoWithBreaks( *this, rPam, (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+    bool const ret = lcl_DoWithBreaks( *this, rPam, (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
                 ? &DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl
                 : &DocumentContentOperationsManager::DeleteAndJoinImpl,
                 bForceJoinNext );
+
+    if (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+    {
+        rPam.Normalize(false); // tdf#127635 put point at the end of deletion
+    }
+
+    return ret;
 }
 
 // It seems that this is mostly used by SwDoc internals; the only


More information about the Libreoffice-commits mailing list