summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2014-11-12 11:18:35 +0100
committerEike Rathke <erack@redhat.com>2014-11-27 14:38:50 +0000
commit2618f8a724481b1a47a0ec8ca6ed2cad6fc21597 (patch)
treed676f8b9dc1645b4083ba13ccb2b5d99a21c336e /sc/source/ui
parent16bfe15d9175f52030bcb1265f8f48728786f910 (diff)
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@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 5456abc4d734583664a55c01a0e750e3051b03c9) Reviewed-on: https://gerrit.libreoffice.org/13153
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 05a718641997..08cba8b8fddd 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1147,16 +1147,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);
}