[Gtk] Fold margin formatting / Folding in the container
"'Robin Haberkorn' via scintilla-interest" <[email protected]> Sun, 27 Apr 2025 02:51:07 +0300 (MSK)
| Newsgroups | gmane.comp.lib.scintilla.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello everyone, while trying to add some kind of folding support to my editor, I found that it is relatively hard to get the fold margin correctly set up under Gtk. By default, the folding symbols will be all circles (SC_MARK_CIRCLE) and what's worse is that they are all black on white including the lines without any markers. The margin type apparently has no influence on this, even though SC_MARGIN_BACK/SC_MARGIN_FORE should somehow cause STYLE_DEFAULT to be respected. Consequently, to configure the fold margin 2 for my color scheme and two fold markers, I'd have to do something like: SCI_SSETFOLDMARGINCOLOUR(1, BGCOLOR) SCI_SSETFOLDMARGINHICOLOUR(1, BGCOLOR) SCI_MARKERDEFINE(SC_MARKNUM_FOLDER, SC_MARK_CHARACTER+'+') SCI_MARKERSETFORE(SC_MARKNUM_FOLDER, FGCOLOR) SCI_MARKERSETBACK(SC_MARKNUM_FOLDER, BGCOLOR) SCI_MARKERDEFINE(SC_MARKNUM_FOLDEROPEN, SC_MARK_CHARACTER+'-') SCI_MARKERSETFORE(SC_MARKNUM_FOLDEROPEN, FGCOLOR) SCI_MARKERSETBACK(SC_MARKNUM_FOLDEROPEN, BGCOLOR) SCI_SETMARGINMASKN(2, (1 << 30) | (1 << 31)) Is this the expected behavior? The fold margin on Scinterm is not black-on-white and even has '+'/'-' markers by default. In a related matter: I found that I couldn't enable folding on a lexer I implemented in the container (ie. by hooking into SCN_STYLENEEDED notifications). It's not sufficient to just set the fold level on lines via SCI_SETFOLDLEVEL. There won't be any fold markers afterwards. I suspect, that it's not currently possible without implementing the ILexer5 interface. If the problem is not on my side, I suggest that this should be fixed. It's not very convenient to wrap ILexer5 in some third language. Even in plain C, which is what I am using, this means to either add a C++ compilation unit and suddenly having to make practically all of my internal headers C++-compatible, or having to write a plain C API wrapper around ILexer5/IDocument with its dozens of functions. Also, I have "dumb" lexers written in my scripting language, that are supposed to style the document only once and it would be nice if I could let them also set the fold levels. Although, for them I could probably implement some dummy ILexer5 instance, which just makes sure that folding is enabled, since they don't actually have to respond to lexing and folding requests dynamically. Best regards, Robin -- You received this message because you are subscribed to the Google Groups "scintilla-interest" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/c16d73e3-4102-c12e-6b75-a19e120ac63c%40googlemail.com.