summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/baside2b.cxx
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-08-19 17:28:52 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-08-19 17:28:52 +0200
commit54704aea436c6dc43a17c8aec5d102cc9652b220 (patch)
tree31545241cebdb0b53d87db50d67ac0e147a7e58a /basctl/source/basicide/baside2b.cxx
parentefb6b286d6a3d879533420d57dd80ced590c055b (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.cxx13
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 );