[MonoDevelop] Managed Line Editor

Matej Urbas matej.urbas at gmail.com
Tue Oct 31 05:09:56 EST 2006


Ok, I'll try to look at this 'project' as an experiment - altough I hope
that in the end it will be useful to MonoDevelop and Mono.

Anyways, I've been doing some research now - looking into internals of a
few selected source code editors:
 - SharpDevelop
 - Eclipse
 - NetBeans
 - jEdit

I haven't been able to figure out much yet (will have to do much more
research before jumping into the code), but I think I've figured that
there are two basically distinct approaches to underlying text buffers:

 - One where all the text is in a simple array

 - and the other where the text is broken up into pieces (be it lines or
any other types of segments).

Both have their pros and cons, e.g.:

 - full-text searching in segmented buffers is hard (it is trivial for
non-segmented buffers)

 - inserting text into large segmented buffers is less cpu and memory
intense (large non-segmented buffers have to copy bytes...)

 - scrolling is faster for line-segmented buffers (non-segmented or
non-line-segmented buffers have to do a linear search for lines or at
least mark points in buffers where lines begin or end)

 - line-segmented buffers are somehow 'natural' for source code or
normal text files

 - segmented buffers take more memory and are harder to implement and
handle with


I'm more in favour of line-segmented buffers - mostly because of faster
line searching and text insertion.

Full-text searching can be solved quite easily: for example, it can be
implemented by joining all segments into full text and then do the
search - since the search operation is much less frequent than inserting
text. It takes up more memory though.


Styled text (underlining, highlighting etc.) is almost uniformly
implemented with some kind of markers. Folds can be implemented with the
help of these markers. Snippets too.


What say you?


Regards,
---
Matej



More information about the Monodevelop-list mailing list