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
#include "ScintillaTypes.h"
#include "ScintillaMessages.h"
/* move cursor to parent line (if current line has a parent) and fold it (hide
its children lines). */
void moveToParentAndFold(line currentLine)
{
line parentLine= SCI_GETFOLDPARENT(currentLine);
// if currently at level 0 (no parents), then effect will be folding
current line
if (parentLine == -1)
parentLine=currentLine;
//set caret at first non-whitespace char in parentLine
SCI_GOTOPOS(SCI_GETLINEINDENTPOSITION(parentLine) );
// fold parentLine
SCI_FOLDLINE(parentLine, SC_FOLDACTION_CONTRACT);
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2920#issuecomment-939264649