[Github-comments] [geany/geany] Folding code: more advanced commands (#2920)
Vic
notifications at xxxxx
Sat Oct 9 09:27:34 UTC 2021
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211009/73f6f30c/attachment.htm>
More information about the Github-comments
mailing list