diff --git a/src/mol-base/collections/ordered-set.ts b/src/mol-base/collections/ordered-set.ts index c51ba055ac4ddb17c1acb54803872c2891d5e992..fea561f31bfe9bee4c91470bffe97c3dafeefb24 100644 --- a/src/mol-base/collections/ordered-set.ts +++ b/src/mol-base/collections/ordered-set.ts @@ -428,7 +428,8 @@ function substractRR(a: Range, b: Range) { if (isRangeSubset(a, b)) { // this splits the interval into two, gotta represent it as a set. const l = _sRB.fst - _sRA.fst, r = _sRA.snd - _sRB.snd; - // TODO: check if l === 0 || r === 0 ==> result would be a range + if (l <= 0) return OrderedSet.ofRange(_sRB.snd + 1, _sRB.snd + r); + if (r <= 0) return OrderedSet.ofRange(_sRA.fst, _sRA.fst + l - 1); const ret = new Int32Array(l + r); let offset = 0; for (let i = 0; i < l; i++) ret[offset++] = _sRA.fst + i;