Incorrect Implementation of TextRange.IntersectsWith

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Walter Leinert - Hewlett Packard GmbH
Avatar
Sytaxeditor v4.0.0277

Hi,

the method TextRange.IntersectsWith() seems to be implemented incorrectly.
E.g. if one range is contained within the other the result of TextRange.IntersectsWith() depends on the calling order.
range1.IntersectsWith(range2) != range2.IntersectsWith(range1).

As workaround i implemented a static utility method:

public static bool IntersectsWith(TextRange range1, TextRange range2) {
return range1.IntersectsWith(range2) || range2.IntersectsWith(range1);
}

Will this issue be fixed?

Regards, Walter

PS: i also submitted an issue ticket 2B8-10C284E6-2DA8.

Comments (1)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Really, it should be more like:
return (range.LastOffset >= this.FirstOffset) && (range.FirstOffset <= this.LastOffset);

We'll get this updated for the next maintenance release.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 10 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.