[Libreoffice-commits] core.git: Branch 'feature/gsoc-basic-ide-completion-and-other-bits' - basctl/source

Gergo Mocsi gmocsi91 at gmail.com
Wed Jul 31 08:32:25 PDT 2013


 basctl/source/basicide/baside2b.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit dc85b9f31c7b7035c9ee11721bfbaef7649afd15
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date:   Wed Jul 31 17:24:15 2013 +0200

    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

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 7b550ba..0cc2f60 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") )


More information about the Libreoffice-commits mailing list