[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-5' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Tue Dec 2 06:04:31 PST 2014


 sc/source/ui/app/inputhdl.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 7a93554500f82adec8f89fd4a137af07ec502013
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Wed Nov 12 11:18:35 2014 +0100

    fdo#86169 fix completion of function name crash
    
    function names with dot or underscore were not completed
    correctly, leading to incorrect results or even crashes
    
    Change-Id: Iacb6af29c609ab39746185c71d4443537bf46b5e
    Reviewed-on: https://gerrit.libreoffice.org/12380
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 5456abc4d734583664a55c01a0e750e3051b03c9)
    Signed-off-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit d4aa91aa4cf7a01915cb9a2b1e4d52e20bf7454b)
    Reviewed-on: https://gerrit.libreoffice.org/13155
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index aa1c955..961cbcd 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1149,16 +1149,23 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser
             aSel = pView->GetSelection();
             ESelection aOldSelection = aSel;
             OUString aSelectedText = pView->GetSelected();
-            while(needToExtendSelection(aSelectedText, rInsert))
+            if ( needToExtendSelection( aSelectedText, rInsert ) )
             {
-                assert(aSel.nStartPos > 0);
-                --aSel.nStartPos;
-                --aSel.nEndPos = aSel.nStartPos;
-                pView->SetSelection(aSel);
-                pView->SelectCurrentWord();
-                aSelectedText = pView->GetSelected();
+                while(needToExtendSelection(aSelectedText, rInsert))
+                {
+                    assert(aSel.nStartPos > 0);
+                    --aSel.nStartPos;
+                    aSel.nEndPos = aSel.nStartPos;
+                    pView->SetSelection(aSel);
+                    pView->SelectCurrentWord();
+                    aSelectedText = pView->GetSelected();
+                }
+                aSel.nStartPos = aSel.nEndPos - ( aSelectedText.getLength() - 1 );
+            }
+            else
+            {
+                aSel.nStartPos = aSel.nEndPos - aSelectedText.getLength();
             }
-            aSel.nStartPos -= ( aSelectedText.getLength() - 1 );
             aSel.nEndPos = aOldSelection.nEndPos;
             pView->SetSelection(aSel);
         }


More information about the Libreoffice-commits mailing list