@@ -30,18 +30,20 @@ public AutoCompleteKeyDownHandler(Func<AutoCompleteSettings> getSettings, Func<L
3030        public  void  Run ( ICodeModule  module ,  Selection  pSelection ,  AutoCompleteEventArgs  e ) 
3131        { 
3232            var  currentContent  =  module . GetLines ( pSelection ) ; 
33-             if  ( HandleSmartConcat ( e ,  pSelection ,  currentContent ,  module ) ) 
34-             { 
35-                 return ; 
36-             } 
33+             HandleSmartConcat ( e ,  pSelection ,  currentContent ,  module ) ; 
34+             if  ( e . Handled )  {  return ;  } 
3735
3836            HandleSelfClosingPairs ( e ,  module ,  pSelection ) ; 
37+             if  ( e . Handled )  {  return ;  } 
38+ 
39+             //HandleSomethingElse(?) 
40+             //if (e.Handled) { return; } 
3941        } 
4042
4143        /// <summary> 
42-         /// Adds a line continuation when {ENTER} is pressed inside a string literal; returns false otherwise . 
44+         /// Adds a line continuation when {ENTER} is pressed inside a string literal. 
4345        /// </summary> 
44-         private  bool  HandleSmartConcat ( AutoCompleteEventArgs  e ,  Selection  pSelection ,  string  currentContent ,  ICodeModule  module ) 
46+         private  void  HandleSmartConcat ( AutoCompleteEventArgs  e ,  Selection  pSelection ,  string  currentContent ,  ICodeModule  module ) 
4547        { 
4648            var  shouldHandle  =  _getSettings ( ) . EnableSmartConcat  && 
4749                               e . Character  ==  '\r '  && 
@@ -57,19 +59,15 @@ private bool HandleSmartConcat(AutoCompleteEventArgs e, Selection pSelection, st
5759                if  ( e . ControlDown ) 
5860                { 
5961                    code  =  $ "{ currentContent . Substring ( 0 ,  pSelection . StartColumn  -  1 ) } \"  & vbNewLine & _\r \n { whitespace } \" { currentContent . Substring ( pSelection . StartColumn  -  1 ) } "; 
60- 
6162                } 
6263
6364                module . ReplaceLine ( pSelection . StartLine ,  code ) ; 
6465                using  ( var  pane  =  module . CodePane ) 
6566                { 
6667                    pane . Selection  =  new  Selection ( pSelection . StartLine  +  1 ,  indent  +  currentContent . Substring ( pSelection . StartColumn  -  2 ) . Length ) ; 
6768                    e . Handled  =  true ; 
68-                     return  true ; 
6969                } 
7070            } 
71- 
72-             return  false ; 
7371        } 
7472
7573        private  void  HandleSelfClosingPairs ( AutoCompleteEventArgs  e ,  ICodeModule  module ,  Selection  pSelection ) 
@@ -115,7 +113,10 @@ private void HandleSelfClosingPairs(AutoCompleteEventArgs e, ICodeModule module,
115113
116114                        module . DeleteLines ( result . SnippetPosition ) ; 
117115                        module . InsertLines ( result . SnippetPosition . StartLine ,  result . Code ) ; 
118-                         var  finalSelection  =  new  Selection ( result . SnippetPosition . StartLine ,  result . CaretPosition . StartColumn  +  1 ) ; 
116+                         var  offByOne  =  result . Code  !=  module . GetLines ( result . SnippetPosition ) ; 
117+ 
118+                         var  finalSelection  =  new  Selection ( result . SnippetPosition . StartLine ,  result . CaretPosition . StartColumn  +  1 ) 
119+                             . ShiftRight ( offByOne  ?  1  :  0 ) ; 
119120                        pane . Selection  =  finalSelection ; 
120121                        e . Handled  =  true ; 
121122                        return ; 
0 commit comments