diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-07-31 17:24:15 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:16:53 +0200 |
commit | a622a19b7acb12375b77bbaa21f6384121780d91 (patch) | |
tree | 4cdb8363a72675ff46144685c216006842eb67e1 /basctl | |
parent | 27da1e7340c37c4cc098a367592da9e0ed42f7dc (diff) |
GSOC work, autoclose procedures fix
Fixed function autoclose procedures: when there was an incomplete function/sub, and the lookahead found another sub/function, autocorrected the wrong ending. This is fixed.
Change-Id: I3d894808fe8111f1ea1fac797b16576d843bff68
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 14460013aed1..7349e8649fc6 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -611,6 +611,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) if( nLine+1 == pEditEngine->GetParagraphCount() ) { //append to the end OUString sText("\nEnd "); + std::cerr << "sProcType: " << sProcType << std::endl; if( sProcType.equalsIgnoreAsciiCase("function") ) sText += OUString( "Function\n" ); if( sProcType.equalsIgnoreAsciiCase("sub") ) @@ -633,12 +634,22 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) { if( sStr1.equalsIgnoreAsciiCase("sub") ) { - pEditView->InsertText( OUString ( "\nEnd Sub\n" ) ); + OUString sText("\nEnd "); + if( sProcType.equalsIgnoreAsciiCase("function") ) + sText += OUString( "Function\n" ); + if( sProcType.equalsIgnoreAsciiCase("sub") ) + sText += OUString( "Sub\n" ); + pEditView->InsertText( sText ); break; } if( sStr1.equalsIgnoreAsciiCase("function") ) { - pEditView->InsertText( OUString ( "\nEnd Function\n" ) ); + OUString sText("\nEnd "); + if( sProcType.equalsIgnoreAsciiCase("function") ) + sText += OUString( "Function\n" ); + if( sProcType.equalsIgnoreAsciiCase("sub") ) + sText += OUString( "Sub\n" ); + pEditView->InsertText( sText ); break; } if( sStr1.equalsIgnoreAsciiCase("end") ) |