Range: intersects: start and end seem to be included
- Langage dominant
- JavaScript
- Étoiles
- 27.1k
- Forks
- 5.3k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### Describe the bug
The intersects method doesn't account for the end boundary of a range which should be excluded from the computation
### Expected Behavior
Given that r1 stops at the start boundary of r2, we expect those two ranges to not intersect.
### Current Behavior
intersects returns true in the case described
### Reproduction Steps
Given the two ranges:
``` js
r1 = new Range(0, 0, 0, 1)
r2 = new Range(0, 1, 0, 2)
r1.intersects(r2)
// true
```
### Possible Solution
Very naive, of course
```js
function intersects(r1, r2, exludeEnd=false) {
if (exludeEnd) {
r2 = {...r2, end: {...r2.end, column: r2.end.column - 1}}
}
return r1.intersects(r2)
}
```
### Additional Information/Context
_No response_
### Ace Version / Browser / OS / Keyboard layout
Ace 1.36.3 / firefox 143 /linux / azerty
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.