Commits

Anonymous committed 759bd92

Fixed indentation.

  • Participants
  • Parent commits b2d74e8

Comments (0)

Files changed (2)

org.lispdev.editor/src/org/lispdev/editor/actions/IndentAction.java

             i0IndentNew = indent.length();
           }
         }
+        else //don't need to indent this line, but need to update indents
+        {
+          indents.add(null);
+        }
 
       }
       newOffset =

org.lispdev.editor/src/org/lispdev/editor/autoedits/IndentOnEnter.java

       		"multiple-value-bind with-slot").split(" "))
   );
 
+  /**
+   * @param doc
+   * @param offset offset in line to indent
+   * @param s0 sexp that defines indentation of the line
+   * @param s0info infor of s0
+   * @param funcLine line at which s0 starts
+   * @param funcLineOffset offset of line at which s0 starts
+   * @param endlOffset end of line at which s0 starts
+   * @param inde indent of s0
+   * @return
+   */
   public static String getIndent(IDocument doc, int offset, Sexp s0,
       SexpInfo s0info, int funcLine, int funcLineOffset, int endlOffset,
-      String indent0)
+      String inde)
   {
     try
     {
-      StringBuilder indent = new StringBuilder(indent0);
+      StringBuilder indent = new StringBuilder(inde);
 
       indent.append(' '); //first token (i.e. opening paren) indent
       final int firstTokenSize = s0.firstToken().text().length();
         }
         else // point is after at least two elements
         {
-          //If the head subform is followed by at least one other subform
+          //If the head subform is followed by at least one argument subform
           //on the same line, then subsequent lines in the form are indented
           //to line up directly under the first argument subform.
-
-          if( offset <= endlOffset )//point is on the same line as head subform
+          Node n1 = s0info.elements.get(1);
+          if( n1.offset() < endlOffset )
           {
-            // get indent to second subform
             Node n0 = s0info.elements.get(0);
-            Node n1 = s0info.elements.get(1);
             for( int i = n0.offset(); i < n1.offset(); ++i )
             {
               indent.append(doc.getChar(i) == '\t' ? '\t' : ' ');
             }
             return indent.toString();
           }
-          else
+          else // first element is on a line by itself
           {
-            // get indent of previous line
-            return getNaturalIndent(offset, doc);
+            if( TreeWalker.isGeneralSymbol(s0info.elements.get(0)) )
+            {
+              indent.append(' ');
+            }
+            return indent.toString();
           }
         }
 
     }
     catch(BadLocationException e)
     {
-      return indent0;
+      return inde;
     }
   }