Re: GtkSourceView: code folding



On Tue, 2014-08-12 at 15:55 +0200, flix wrote:
Well, yes, actually I've already made the gutter part myself and it's 
working great (zoom included). Initially I just used the default 
implementation Gsv provides for Gsv::Mark icons (by swapping a 
'collapsed mark' with an 'expanded mark' to change state): it worked, 
but with a custom gutter rendered I managed to use just one mark 
(extended to contain the folding state) for both states, and to make 
zooming work in the gutter icons too.

What do you call "zooming" in the context of code folding?
With a custom gutter renderer you can draw also a vertical line below
the + buttons, to show where the "foldable" region stops (like Scintilla
does). Or you can draw different background colors, like Qt text editors
do.

However the main problem of my post is that the TextChildAnchor is 
necessary if we want to handle collapsed regions properly (for example 
for saving all the possible space, or to implement free collapsable 
regions, like in C#)

I don't follow you, what is a free collapsable region? A block beginning
and ending in the middle of a line? If so, is the code folding really
useful for such blocks?

Btw, the code folding is still not implemented in GtkSourceView or gedit
because we don't think it is a really useful feature. Having the
structure of the file in the side panel is more useful in my opinion.
Like the list of functions, or the list of chapters, sections, etc of a
LaTeX document.

That's why my primary issue is to find out how to remove obj characters 
(TextChildAnchors in my case, but Pixbufs inside text too) from the undo 
stack.

The default undo manager can be improved to handle correctly non-text
elements. If you really need this, you can file a bug on bugzilla.

But using a GtkTextChildAnchor for the code folding seems like a hack to
me. Especially with a GtkLabel inside it, since it can easily be
replaced by normal text in the GtkTextBuffer.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]