ajaxorg / ajaxorg/ace

Range: intersects: start and end seem to be included

Aperta
#5,877 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
effort/small feature-request p2
Lingua principale
JavaScript
Stelle
27.1k
Fork
5.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.