[MonoDevelop] Coordinate system refactoring

Mike Krüger mkrueger at novell.com
Mon Jul 19 04:13:26 EDT 2010


I want to refactor the line/column/location refactoring.

What we have now:

A DomLocation in MonoDevelop.Core a DocumentLocation in Mono.TextEditor 
which are exactly the same.
A 0 based coordinate system in Mono.TextEditor and some other parts in 
the IDE.
A 1 based coordinate system in the Dom and some other parts of the IDE.

The problem is that 'other parts of the IDE' isn't 100% clear - it has 
even not that many to do which location is used :(

What I want:

To be able to write:

Caret.Location = member.Location.

Instead of:
Caret.Location = new DocumentLocation (member.Location.Line - 1, 
member.Location.Column - 1);

And no confusion in the coordine systems in 'other parts of the IDE'.

What we need:
+ A reference to Mono.TextEditor from Mono.Core & replacing DomLocation 
with DocumentLocation
+ A decision which coordinate system is used.

Now the question is:

Should we use a 0 based coordinate system or a 1 based ?

My preference would be a 0 based coordinte system for internal 
representation - my wife votes for a 1 based - therefore I need YOUR input.

Yes the transition of coordinate systems >may< cause some bugs - but 
currently we already HAVE bugs in the ide because we use different 
coordinate systems and I would prefer not spending any more time to hunt 
bugs caused by +-1 coordinate system annoyances.


More information about the Monodevelop-list mailing list