[Monodevelop-devel] Text Editor API GetCharAt
mkrueger at xamarin.com
Sat Jun 21 08:54:22 UTC 2014
We've 3 levels:
ITextSource -> IDocument -> TextEditor
And they inherit from each other. So if you've a text source you're
having either the GetCharAt or indexer way of accessing the characters.
With the new API I want it to make it easier to write code for the
ITextSource or IDocument level and use a text editor object with it.
Depends on the way we want to look at the whole thing.
If we treat the text as char and lines, syntax highlighting, text
markers etc. is just meta data to the char array I think the indexer
makes sense. If we say the work with text is more complex and maybe the
O(1) cost of getting a char will change then the GetCharAt approach is
I'm not really certain which way is the best.
But one thing is for sure: We either have the indexer at all levels or not.
> I think it is obvious and intuitive at the Text level, but for Document
> and Editor then it becomes a bit less intuitive.
> As Mike said, the Document has lines as well as characters. How often is
> someone going to want to use the index as a line vs as a character?
> Which would you assume is which? I think it is probably clearer to keep
> the methods at those levels so that you don't have to check the return
> type to know what you're indexing.
More information about the Monodevelop-devel-list