/* :folding=none: * This macro will expand all folds beginning with +{{{ * and collapse all folds beginning with -{{{ in the current buffer. * @author Brad Mace * @version 1.1 */ int startLine = textArea.getCaretLine(); DisplayManager dm = textArea.getDisplayManager(); for (int l = 0; l < textArea.getLineCount(); l++) { String line = textArea.getLineText(l); if (line.matches(".*\\+\\{{3}.*")) { //System.out.println("+"+l+" "+line); dm.expandFold(l+1,false); } else if (line.matches(".*\\-\\{{3}.*")) { //System.out.println("-"+l+" "+line); dm.collapseFold(l+1); } } while (!dm.isLineVisible(startLine)) { dm.expandFold(startLine,false); } textArea.scrollToCaret(false);