From a622a19b7acb12375b77bbaa21f6384121780d91 Mon Sep 17 00:00:00 2001 From: Gergo Mocsi Date: Wed, 31 Jul 2013 17:24:15 +0200 Subject: 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 --- basctl/source/basicide/baside2b.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'basctl') 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") ) -- cgit