Patch #3347 2012-10-06 18:25

alpha0010

SmartIndent: more smart indenting
Download
3347-SmartIndent_mo.patch (30.8 KB)
Category
Plugin::FeatureAdd
Status
Accepted
Close date
2012-10-12 08:46
Assigned to
mortenmacfly
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 8435)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -2440,10 +2440,13 @@
             int depth = 1; // search forwards
             for (int i = control->GetCurrentLine() + 1; i < control->GetLineCount(); ++i)
             {
-                if (ppIf.Matches(control->GetLine(i))) // ignore else's, elif's, ...
-                    ++depth;
-                else if (ppEnd.Matches(control->GetLine(i)))
-                    --depth;
+                if (control->GetLine(i).Find(wxT('#')) != wxNOT_FOUND) // limit testing due to performance cost
+                {
+                    if (ppIf.Matches(control->GetLine(i))) // ignore else's, elif's, ...
+                        ++depth;
+                    else if (ppEnd.Matches(control->GetLine(i)))
+                        --depth;
+                }
                 if (depth == 0)
                 {
                     pp.Matches(control->GetLine(i));
@@ -2457,10 +2460,13 @@
             int depth = -1; // search backwards
             for (int i = control->GetCurrentLine() - 1; i >= 0; --i)
             {
-                if (ppIf.Matches(control->GetLine(i))) // ignore else's, elif's, ...
-                    ++depth;
-                else if (ppEnd.Matches(control->GetLine(i)))
-                    --depth;
+                if (control->GetLine(i).Find(wxT('#')) != wxNOT_FOUND) // limit testing due to performance cost
+                {
+                    if (ppIf.Matches(control->GetLine(i))) // ignore else's, elif's, ...
+                        ++depth;
+                    else if (ppEnd.Matches(control->GetLine(i)))
+                        --depth;
+                }
                 if (depth == 0)
                 {
                     pp.Matches(control->GetLine(i));
@@ -2473,7 +2479,10 @@
 
     // now, we either found it or not
     if (matchingBrace != wxSCI_INVALID_POSITION)
+    {
         control->GotoPos(matchingBrace);
+        control->ChooseCaretX();
+    }
 }
 
 void cbEditor::HighlightBraces()
Index: src/sdk/resources/lexers/lexer_html.xml
===================================================================
--- src/sdk/resources/lexers/lexer_html.xml    (revision 8435)
+++ src/sdk/resources/lexers/lexer_html.xml    (working copy)
@@ -270,6 +270,10 @@
                     BoxCommentStart="/* "
                     BoxCommentMid=" * "
                     BoxCommentEnd=" */"
-                    CaseSensitive="0"/>
+                    CaseSensitive="0"
+                    LexerCommentStyles="9,20,29,42,43,44,57,58,59,72,82,92,107,124,125"
+                    LexerCharacterStyles=""
+                    LexerStringStyles="5,6,7,17,24,25,48,49,63,64,75,77,85,87,94,95,109,110,119,120"
+                    LexerPreprocessorStyles=""/>
         </Lexer>
 </CodeBlocks_lexer_properties>
Index: src/sdk/resources/lexers/lexer_java.xml
===================================================================
--- src/sdk/resources/lexers/lexer_java.xml    (revision 8435)
+++ src/sdk/resources/lexers/lexer_java.xml    (working copy)
@@ -94,16 +94,22 @@
                                    char     final     interface  static    void
                                    class    finally   long       strictfp  volatile
                                    const    float     native     super     while
-                   true     false     null"/>
+                                   true     false     null"/>
                         <!-- Secondary keywords and identifiers -->
                         <Set index="1"
-                            value="String"/>
+                            value="Boolean          Byte          Character         Class      ClassLoader
+                                   Compiler         Double        Enum              Float      InheritableThreadLocal
+                                   Integer          Long          Math              Number     Object
+                                   Package          Process       ProcessBuilder    Runtime    RuntimePermission
+                                   SecurityManager  Short         StackTraceElement StrictMath String
+                                   StringBuffer     StringBuilder System            Thread     ThreadGroup
+                                   ThreadLocal      Throwable"/>
                         <!-- Documentation comment keywords -->
                         <Set index="2"
                             value="author docRoot   deprecated  exception   inheritDoc
-                       link   linkplain literal     param       return
-                   see    serial    serialData  serialField since
-                   throws value     version     $ @ \ & < > # { }"/>
+                                   link   linkplain literal     param       return
+                                   see    serial    serialData  serialField si
download for full patch...