sw/source/core/doc/docredln.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 6a3f8d893d4456f86a3c213d04baad2ed9c6bbcd
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Sat Jan 22 11:23:34 2022 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Jan 26 13:51:02 2022 +0100

    tdf#146857 sw change tracking: fix freezing during Undo
    
    Re-insertion of hundreds of redlines during Undo resulted
    freezing, because of the unnecessary call of isMoved() in
    SwRedlineTable::Insert(), multiplying the slow Undo by
    ~40 extra redline checkings around each redline to find
    tracked text movings.
    
    Stop unnecessary call of isMoved() during Undo in
    SwRedlineTable::Insert(). The state of isMoved bit i.e.
    the green/double strikethrough/underline redline
    formatting is preserved anyway.
    
    Regression from commit f51fa7534421a195a58b4a737a2e836d8c25ba81
    "tdf#145718 sw, DOCX import: complete tracked text moving".
    
    Change-Id: Ib7901c7b4fefd87633c49ef252750b84dcdb73dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128762
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit b15638440d692dd8cce55c0e936fbb82d24f8414)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128953

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 0d0b7fa621e2..cb6fb4f3302c 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -411,8 +411,15 @@ bool SwRedlineTable::Insert(SwRangeRedline*& p)
         size_type nP = rv.first - begin();
         LOKRedlineNotification(RedlineNotification::Add, p);
 
-        // set IsMoved checking nearby redlines
-        isMoved(nP);
+        // detect text moving by checking nearby redlines, except during Undo
+        // (apply isMoved() during OpenDocument and DOCX import, too, to fix
+        // missing text moving handling in ODF and e.g. web version of MSO)
+        if ( p->GetDoc().GetIDocumentUndoRedo().DoesUndo() ||
+             p->GetDoc().IsInWriterfilterImport() ||
+             p->GetDoc().IsInXMLImport() )
+        {
+            isMoved(nP);
+        }
 
         p->CallDisplayFunc(nP);
         if (rv.second)

Reply via email to