[MonoDevelop] Why MonoDevelop doesn't use GtkTextView/GtkSourceView?

Sébastien Wilmet swilmet at gnome.org
Sat Aug 23 16:11:22 UTC 2014

On Sat, Aug 23, 2014 at 03:41:45PM +0200, Mike Krüger wrote:
> The search & replace idea was taken from us - therefore it's a bad example
> :).

Not the new search and replace API in GtkSourceView. Completely
different UIs and behaviors are possible with the API.

> Code folding is always possible to implement to a degree. But implementing
> like we did would require to change text lay outing (we're drawing folding
> markers as part of the layout) and background drawing - see the animations.

Images or anchor widgets can be added to a GtkTextBuffer. Custom drawing
is also possible below or above the text. Or it can be achieved simply
with text tags.

> It's not a trivial implementation we have. Reworking the gtksourceview
> syntax highlighting, theming, folding, margins and so on would bring us very
> close to an own editor implementation anyways.

You would reuse the low-level implementation (GtkTextView) and use some
of the GtkSourceView features. For the margins there is now GtkSourceGutter.

> GtkSourceView is nice - I do not have complains about that but it doesn't
> solve our problem.

Some features are common to each text editor or IDE: undo/redo, file
loading and saving, margin/gutter (line numbers, marks, …), printing,
search and replace, etc.

GtkSourceView should be flexible enough for every text editor or IDE. If
some features are not suitable for a certain application, then
GtkSourceView should be improved (and bugs and feature requests should
be filed on bugzilla).

> >Is snapshotting different than a point in the undo/redo list? Or the
> >text buffer saved to a temporary file?
> Yes it is because it should be a O(1) operation that brings the whole text
> representation in an immutable state so that it can be used by background
> threads.

Interesting. What is usually done in GtkSourceView is to execute the
background work on small chunks of text in an idle. The remaining region
of text to analyze is maintained in a data structure. When an insertion
or deletion occurs in the text buffer, the region is updated

Do you have an example of a feature that uses a snapshot?

> It's even more maintenance work if we would've stuck to GtkSourceView
> because it adds a dependency for us and adds limitations to what can be done
> (like the find animations which required changes to the gtksourceview).
> We've tons of commands that are working differently on certain platforms
> (mac/windows/linux behavior is not the same) - it's really hard to implement
> all that if you give up control.

Contributions to GtkSourceView/GtkTextView are more than welcome. But
since you don't like the C language…

> We've really many features that are hard to implement in a general purpose
> editor  - if it's not supported like our virtual indentation spaces. And now
> it's too late anyways - our text editor is now mature enough after 7 years
> of development.

Yes, it's too late for MonoDevelop. But it is maybe still the time for
other IDEs. And I prefer if GtkTextView and GtkSourceView are improved
instead of reinventing the wheel.

What is the virtual indentation spaces?

In summary, if you still remember how GtkTextView works, what should be
improved or changed in GtkTextView?

> (And as said - we've been using GtkSourceView before that and felt it was
> too limited for our use case at that time - 7 years ago - I think that the
> GtkSourceView has evolved a lot since then. But atm I don't really see any
> reason for switching back.
> Can you give one ? (The maintainance work isn't much right now - most of the
> ongoing editor work is implementing new features or changing old ones)

I think all the features of GtkSourceView are already implemented in
MonoDevelop. Maybe the search and replace works better in GtkSourceView
(including regex search), I don't know. Last time that I've used
MonoDevelop to test the search and replace, I've found a few bugs. Maybe
GtkSourceView has fewer bugs, since it is used by more applications and
tested in more different use cases. The GtkSourceView API is also well


More information about the Monodevelop-list mailing list