diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-08-19 17:28:52 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:17:00 +0200 |
commit | 31f3859884618cc19d0810795c45c9f6ed73e622 (patch) | |
tree | 85763012f58fd928a942ec3b20f1450821cbb6e1 /basctl | |
parent | d977f5951443aa45ab2e44aa2cb72ac0bbf0af57 (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')
-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 6f8bc6105b23..e73d66df8387 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -794,11 +794,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 ); |