[Libreoffice-commits] core.git: editeng/source

Mark Hung marklh9 at gmail.com
Thu Jan 4 11:24:21 UTC 2018


 editeng/source/editeng/editeng.cxx |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

New commits:
commit a16b44481e3c5582dfb581f769e07ab94e8ac44b
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Dec 30 01:00:26 2017 +0800

    tdf#114732 backspace can only make bullet invisible.
    
    It toggled the bullet on unexptectedly before connecting
    two paragraphs, which made undo recover the incorrect result.
    
    Change-Id: I83104d72fef95d8bd95e8e0e3bca4a063b69a450
    Reviewed-on: https://gerrit.libreoffice.org/47181
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 2a3ccb3d52bb..c896e9aeb2f7 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1121,28 +1121,29 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
                     if (pFmt && nCode == KEY_BACKSPACE &&
                         !aCurSel.HasRange() && aCurSel.Min().GetIndex() == 0)
                     {
-                        // if the bullet is still visible just do not paint it from
-                        // now on and that will be all. Otherwise continue as usual.
+                        // if the bullet is still visible, just make it invisible.
+                        // Otherwise continue as usual.
 
 
                         sal_Int32 nPara = pImpEditEngine->GetEditDoc().GetPos( pNode );
                         SfxBoolItem aBulletState( pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) );
-                        bool bBulletIsVisible = aBulletState.GetValue();
 
-                        // just toggling EE_PARA_BULLETSTATE should be fine for both cases...
-                        aBulletState.SetValue( !bBulletIsVisible );
-                        SfxItemSet aSet( pImpEditEngine->GetParaAttribs( nPara ) );
-                        aSet.Put( aBulletState );
-                        pImpEditEngine->SetParaAttribs( nPara, aSet );
+                        if ( aBulletState.GetValue() )
+                        {
+
+                            aBulletState.SetValue( false );
+                            SfxItemSet aSet( pImpEditEngine->GetParaAttribs( nPara ) );
+                            aSet.Put( aBulletState );
+                            pImpEditEngine->SetParaAttribs( nPara, aSet );
 
-                        // have this and the following paragraphs formatted and repainted.
-                        // (not painting a numbering in the list may cause the following
-                        // numberings to have different numbers than before and thus the
-                        // length may have changed as well )
-                        pImpEditEngine->FormatAndUpdate( pImpEditEngine->GetActiveView() );
+                            // have this and the following paragraphs formatted and repainted.
+                            // (not painting a numbering in the list may cause the following
+                            // numberings to have different numbers than before and thus the
+                            // length may have changed as well )
+                            pImpEditEngine->FormatAndUpdate( pImpEditEngine->GetActiveView() );
 
-                        if (bBulletIsVisible)   // bullet just turned invisible...
                             break;
+                        }
                     }
 
                     sal_uInt8 nDel = 0;


More information about the Libreoffice-commits mailing list