User forums > Help
Highlighting the active folding block
Ramzy2020:
Hi everyone,
I am looking for a way to add a highlighting color option for the active fold when the caret is inside it (i.e., to color the margin's folding line when the caret is inside the folding region). It is the red line on the left in the attached image (pasted from another editor that I am migrating from to Code:Blocks).
I searched a lot but could not find an option for it in Code::Blocks, or how to do it over the internet.
What I found is that it is a Scintilla option, which I believe is the same library that provides text editing functions to Code::Blocks. The following option controls the color in the previous editor: <WidgetStyle name="Fold active" styleID="0" fgColor="FF0000" />.
Can an option like this (WidgetStyle name="Fold active") be added to Code::Blocks in some way? Is this related to wxScintilla?
Thank you very much in advance!
oBFusCATed:
--- Quote ---SCI_SETHIGHLIGHTGUIDE(position column)
SCI_GETHIGHLIGHTGUIDE → position
When brace highlighting occurs, the indentation guide corresponding to the braces may be highlighted with the brace highlighting style, STYLE_BRACELIGHT (34). Set column to 0 to cancel this highlight.
--- End quote ---
This is what we have and what we use: if you put your cursor on an open brace it will highlight the indent to the close brace.
Obviously this works only for languages with braces. :)
If you can make the feature you want in another scintilla based editor, I'll be happy to take a look and try to replicate it.
Ramzy2020:
Hi oBFusCATed,
Thank you very much in advance. Yes I actually found the respective main patch used to push that into Scintilla. It is on the following website https://sourceforge.net/p/scintilla/feature-requests/765/?page=0
I actually admire how the guy insisted on adding the feature until it is implemented in Scintilla! Patch 14 should be the file to download. The Scintilla option is:
--- Code: ---SCI_MARKERENABLEHIGHLIGHT
--- End code ---
The option to be added to the editor, I think, is: [editor:MarkerEnableHighlight(bool enabled) -- Enable/disable highlight for current folding block (smallest one that contains the caret)]. This can be found in Scintilla's API documentation here https://www.scintilla.org/PaneAPI.html
I also found the same option in wxWidgets here: https://docs.wxwidgets.org/trunk/classwx_styled_text_ctrl.html#aba8bda36ef191f934608aa4a4280ee44
I hope this helps more with the implementation. Thank you very much for your help with this!
oBFusCATed:
Good we have this event, so it would be easy thing to add. I suppose the hardest thing is to find where to put the option and how to name it. :)
Could you log this as feature request on https://sourceforge.net/p/codeblocks/tickets/ ?
Ramzy2020:
Okay nice :) Thank you very much for taking this matter into your hands! I have opened a feature-request ticket #1038 as well.
If I may suggest, I think it can be added under Settings > Editor > Folding. It can also be named "Enable active fold highlighting".
Thanks again!
Navigation
[0] Message Index
[#] Next page
Go to full version