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

Michael Stahl mstahl at redhat.com
Tue Sep 15 07:15:27 PDT 2015


 sw/source/core/layout/layact.cxx  |    4 +++-
 sw/source/core/txtnode/txtedt.cxx |    8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 9962cb4bdaa7f9cf6c7a3c9e1dd17e2a51052588
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Sep 14 20:10:45 2015 +0200

    tdf#93261: sw: fix idle auto-complete collection loop on big paras
    
    5 ms timers cause SwTextFrm::CollectAutoCmplWrds() to return
    early, and unlike the auto-spelling stuff there is nothing to store the
    already-checked range of the paragraph, so on the next iteration it will
    start from the beginning and time-out again.
    
    Prevent that by excluding TIMER events here, as is already done for the
    ONLINE_SPELLING case.
    
    Change-Id: Iac781f10ce0aef902fa921030e61b4cff65d0cb3
    (cherry picked from commit b4f35a7450830979b937ec6ae3b6d638302093d2)
    Reviewed-on: https://gerrit.libreoffice.org/18590
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 3c61e30..ba9edb0 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1943,7 +1943,9 @@ bool SwLayIdle::_DoIdleJob( const SwContentFrm *pCnt, IdleJobType eJob )
             }
             case AUTOCOMPLETE_WORDS :
                 const_cast<SwTextFrm*>(static_cast<const SwTextFrm*>(pCnt))->CollectAutoCmplWrds( pContentNode, nTextPos );
-                if ( Application::AnyInput( VCL_INPUT_ANY ) )
+                // note: bPageValid remains true here even if the cursor
+                // position is skipped, so no PENDING state needed currently
+                if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
                     return true;
                 break;
             case WORD_COUNT :
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 482ac20..c256228 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1594,7 +1594,8 @@ void SwTextFrm::CollectAutoCmplWrds( SwContentNode* pActNode, sal_Int32 nActPos
             }
             if( !--nCnt )
             {
-                if ( Application::AnyInput( VCL_INPUT_ANY ) )
+                // don't wait for TIMER here, so we can finish big paragraphs
+                if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
                     return;
                 nCnt = 100;
             }
commit d121cc8037ddcb36763e665cf178791e6e3cafd5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Sep 14 19:30:54 2015 +0200

    tdf#93261: sw: fix idle auto-complete collection loop on empty paras
    
    So the auto-spell-checking is hyper-optimized to add the words to the
    auto-complete list as well, and call SetAutoCompleteWordDirty().
    
    But if you disable the auto-spell-checking, then a separate function
    SwTextFrm::CollectAutoCmplWrds() will be called, which is buggy because
    it only resets the dirty flag if at least one word of sufficient length
    was found in the paragraph, which is never the case for an empty
    paragraph.
    
    Change-Id: Idec64fc3c379301426a44e06a1114c474de36014
    (cherry picked from commit 97c6dac69ac2ad9cb20ba4d3c167d22a19922700)
    Reviewed-on: https://gerrit.libreoffice.org/18589
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index adcbf5c..482ac20 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1569,7 +1569,7 @@ void SwTextFrm::CollectAutoCmplWrds( SwContentNode* pActNode, sal_Int32 nActPos
     sal_Int32  nBegin = 0;
     sal_Int32  nEnd = pNode->GetText().getLength();
     sal_Int32  nLen;
-    bool bACWDirty = false, bAnyWrd = false;
+    bool bACWDirty = false;
 
     if( nBegin < nEnd )
     {
@@ -1588,7 +1588,6 @@ void SwTextFrm::CollectAutoCmplWrds( SwContentNode* pActNode, sal_Int32 nActPos
                 {
                     if( rACW.GetMinWordLen() <= rWord.getLength() )
                         rACW.InsertWord( rWord, *pDoc );
-                    bAnyWrd = true;
                 }
                 else
                     bACWDirty = true;
@@ -1602,7 +1601,7 @@ void SwTextFrm::CollectAutoCmplWrds( SwContentNode* pActNode, sal_Int32 nActPos
         }
     }
 
-    if( bAnyWrd && !bACWDirty )
+    if (!bACWDirty)
         pNode->SetAutoCompleteWordDirty( false );
 }
 


More information about the Libreoffice-commits mailing list