summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-07-31 17:24:15 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-07-31 17:26:07 +0200
commitdc85b9f31c7b7035c9ee11721bfbaef7649afd15 (patch)
tree0013189216de35a0fa6a3c76c9179ae5c692c0ed
parentbc7e841728c820de6d2fade0c052e53da4a87bcf (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
-rw-r--r--basctl/source/basicide/baside2b.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 7b550ba388e4..0cc2f60989cb 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -605,6 +605,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") )
@@ -627,12 +628,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") )