Re: GtkSourceView: code folding



On 08/12/2014 05:02 PM, Paolo Borelli wrote:
Well, while it is true that we are not particularly interested in getting this in gedit, but I still would very much welcome code folding as a feature in gtksourceview.

Note that there is a bug open in bugzilla that contains an implementation of a folding API for gtksourceview, and the drawing part was working quite nicely last time it was tested (but I am pretty sure things have bitrotten in the mean time). Things were stuck because we wanted to implement the folding logic itself based on the highlighter, but I think that is not a requirement and we could merge an API that allows to fold part of the text, leaving to the caller the logic of where to fold.

I think I understood what you want to do with the text anchor: you want a small clickable target within the buffer, something like [...] to show that there is folded text. The code in the bug/branch I mentioned had this feature, but I think it was done by simply drawing on top of the text instead of inserting a widget.

Well, since I'm completely stuck with fixing the undo/redo functionality, maybe trying to add a child window overlay could be a good alternative to me (no spurious character inserted in the buffer = no undo stack corruption). However I guess that synchronizing it with the scrolled buffer would be difficult too...

If you would like to pick up that bug, compare the proposed api/implementation with yours, and try to push things forward in gtksourceview itself, it would be very welcome. Beside, also preliminary patches to undomanager or other parts to make your implementation work would surely be considered.
Well, actually I'm not good at programming in plain C. My purpose is just to make a working compact C++ implementation. Of course if (and when) I'll manage to make it work, I'd be happy to share it.

Ciao

    Paolo

Ciao.



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