Here's a first draft for CO1, based on https://www.scintilla.org/ScintillaDoc.html, especially https://www.scintilla.org/ScintillaDoc.html#Folding. **But** I'm a beginner in C, I've never contributed code to online projects before, and I have no idea where exactly this would be integrated in Geany. So any advice/info is welcome to make this more fun :) ``` c // for `line` type, https://www.scintilla.org/ScintillaDoc.html #include "ScintillaTypes.h" #include "ScintillaMessages.h"
/* move cursor to parent line (if current line has a parent) and fold it (hide its children lines). * if currently at level 0 (no parents), then effect will be folding current line */ void moveToParentAndFold() { currentLine = SCI_LINEFROMPOSITION(SCI_GETCURRENTPOS);
line parentLine= SCI_GETFOLDPARENT(currentLine); if (parentLine == -1) parentLine=currentLine;
//set caret at first non-whitespace char in parentLine SCI_GOTOPOS(SCI_GETLINEINDENTPOSITION(parentLine) );
SCI_FOLDLINE(parentLine, SC_FOLDACTION_CONTRACT);
} ```