correction 2 ofr indentation by selection
Sylvestre Koumar [Thu, 17 Sep 2009 08:19:38 +0000 (10:19 +0200)]
scilab/modules/xpad/src/java/org/scilab/modules/xpad/style/ScilabStyleDocument.java

index 846eca8..01ff88c 100644 (file)
@@ -51,7 +51,7 @@ public class ScilabStyleDocument extends DefaultStyledDocument implements Docume
                }
        };
 
-       private boolean autoIndent = false;
+       private boolean autoIndent = true;
        private boolean autoColorize = true;
        private boolean colorizeInprogress = false;
        private boolean indentInprogress = false;
@@ -512,6 +512,17 @@ public class ScilabStyleDocument extends DefaultStyledDocument implements Docume
                                                        tab = tab.substring(0, tab.length()-2);
                                                }
                                        }
+                                       if ((current_vector_match.elementAt(1).toLowerCase().equals("else")) || 
+                                                       (current_vector_match.elementAt(1).toLowerCase().equals("elseif"))) {
+                                               if (tab.length() >= 2) {
+                                                       tab = tab.substring(0, tab.length()-2);
+                                               }
+                                       }
+                                       if ((current_vector_match.elementAt(1).toLowerCase().equals("case"))) {
+                                               if (tab.length() >= 2) {
+                                                       tab = tab.substring(0, tab.length()-2);
+                                               }
+                                       }
                                }
                        } catch (BadLocationException e) {
                                e.printStackTrace();