## org.gjt.sp.jedit.buffer
Class IndentFoldHandler

    java.lang.Object
      org.gjt.sp.jedit.buffer.FoldHandler
          org.gjt.sp.jedit.buffer.IndentFoldHandler

    public class IndentFoldHandler

extends FoldHandler

A fold handler that folds lines based on their indent level.

Since:
  jEdit 4.0pre1

Field Summary

Fields inherited from class org.gjt.sp.jedit.buffer.FoldHandler
`foldHandlerProvider`

Constructor Summary
`IndentFoldHandler()`

Method Summary
`int` `getFoldLevel(JEditBuffer buffer, int lineIndex, javax.swing.text.Segment seg)` Returns the fold level of the specified line.
`java.util.List<java.lang.Integer>` `getPrecedingFoldLevels(JEditBuffer buffer, int lineIndex, javax.swing.text.Segment seg, int lineFoldLevel)` Returns the fold levels of the lines preceding the specified line, which depend on the specified line.

Methods inherited from class org.gjt.sp.jedit.buffer.FoldHandler
`equals, getFoldHandler, getFoldModes, getName, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IndentFoldHandler

    public IndentFoldHandler()

Method Detail

### getFoldLevel

    public int getFoldLevel(JEditBuffer buffer,
                            int lineIndex,
                            javax.swing.text.Segment seg)

  Returns the fold level of the specified line. For a whitespace-only line, returns the fold level of the next non-whitespace line, or the level of the previous line if no non-whitespace line follows or if the level of the previous line is higher.

  Specified by:
    `getFoldLevel` in class `FoldHandler`
  Parameters:
    `buffer` - The buffer in question
    `lineIndex` - The line index
    `seg` - A segment the fold handler can use to obtain any text from the buffer, if necessary
  Returns:
    The fold level of the specified line
  Since:
    jEdit 4.0pre1

### getPrecedingFoldLevels

    public java.util.List<java.lang.Integer> getPrecedingFoldLevels(JEditBuffer buffer,
                                                                    int lineIndex,
                                                                    javax.swing.text.Segment seg,
                                                                    int lineFoldLevel)

  Returns the fold levels of the lines preceding the specified line, which depend on the specified line.

  Overrides:
    `getPrecedingFoldLevels` in class `FoldHandler`
  Parameters:
    `buffer` - The buffer in question
    `lineIndex` - The line index
    `seg` - A segment the fold handler can use to obtain any
    `lineFoldLevel` - The fold level of the specified line
  Returns:
    The fold levels of the preceding lines, in decreasing line number order (i.e. bottomost line first).
  Since:
    jEdit 4.3pre18