Module jEdit

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
Version:
$Id: IndentFoldHandler.java 25194 2020-04-11 17:03:59Z kpouer $
Author:
Slava Pestov
  • Constructor Details

    • IndentFoldHandler

      public IndentFoldHandler()
  • Method Details

    • getFoldLevel

      public int getFoldLevel(JEditBuffer buffer, int lineIndex, 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 List<Integer> getPrecedingFoldLevels(JEditBuffer buffer, int lineIndex, 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