diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-08-19 17:28:52 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-08-19 17:28:52 +0200 |
commit | 54704aea436c6dc43a17c8aec5d102cc9652b220 (patch) | |
tree | 31545241cebdb0b53d87db50d67ac0e147a7e58a /basctl/source/basicide/baside2b.cxx | |
parent | efb6b286d6a3d879533420d57dd80ced590c055b (diff) |
GSOC work, options fix
Tools/Options are now saving correctly.
I've added a check for empty string in EditorWindow::HandleCodeCompletition.
Change-Id: Ib5d75fe840e3c3fd12cd7175fb7828b8a1d76db6
Diffstat (limited to 'basctl/source/basicide/baside2b.cxx')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 2e062320476b..7d67327b4d93 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -788,11 +788,14 @@ void EditorWindow::HandleCodeCompletition() OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName ); if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectOn() ) {//correct variable name, if autocorrection on - TextPaM aStart(nLine, aLine.indexOf(sBaseName) ); - TextPaM aEnd(nLine, aLine.indexOf(sBaseName) + sBaseName.getLength() ); - TextSelection sTextSelection(aStart, aEnd); - pEditEngine->ReplaceText( sTextSelection, aCodeCompleteCache.GetCorrectCaseVarName(sBaseName, GetActualSubName(nLine)) ); - pEditView->SetSelection( aSel ); + const OUString& sStr = aCodeCompleteCache.GetCorrectCaseVarName( sBaseName, GetActualSubName(nLine) ); + if( !sStr.isEmpty() ) + { + TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() ); + TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex())); + pEditEngine->ReplaceText( sTextSelection, sStr ); + pEditView->SetSelection( aSel ); + } } UnoTypeCodeCompletetor aTypeCompletor( aVect, sVarType ); |