# Is findMarks(from, to) supposed to be inclusive?

**URL:** <https://discuss.codemirror.net/t/is-findmarks-from-to-supposed-to-be-inclusive/844>\
**Category:** Uncategorized\
**Created:** [July 28, 2016, 12:21am UTC](https://discuss.codemirror.net/t/is-findmarks-from-to-supposed-to-be-inclusive/844 "2016-07-28T00:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dflanders](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@dflanders](https://discuss.codemirror.net/u/dflanders)\
**Post date:** [July 28, 2016, 12:21am UTC](https://discuss.codemirror.net/t/is-findmarks-from-to-supposed-to-be-inclusive/844/1 "2016-07-28T00:21:34Z")

</div>

Currently findMarks seems to be exclusive for the endpoints of the range. I was wondering if this is a bug and findMarks should instead be inclusive?

Without being inclusive, I cannot use this function to find a bookmark that is at the very beginning or end of a document, for example.

If it should be inclusive, I believe the change would be \>= to \>

> ```
> if (!(span.to != null && lineNo == from.line && from.ch > span.to ||
> span.from == null && lineNo != from.line ||
> span.from != null && lineNo == to.line && span.from > to.ch) &&
> (!filter || filter(span.marker)))
> found.push(span.marker.parent || span.marker);
> 
> ```

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)\
**Post date:** [July 29, 2016, 3:16pm UTC](https://discuss.codemirror.net/t/is-findmarks-from-to-supposed-to-be-inclusive/844/2 "2016-07-29T15:16:37Z")

</div>

No, it’s intentionally not inclusive, and I don’t want to change that. This is intended to find the active marks at a given position. If you want the marks _at_ a given position, use `findMarksAt`.

---

<div class="post-metadata">

**Author:** ![dflanders](https://discuss.codemirror.net/letter_avatar_proxy/v4/letter/d/e36b37/32.png) [@dflanders](https://discuss.codemirror.net/u/dflanders)\
**Post date:** [July 29, 2016, 3:40pm UTC](https://discuss.codemirror.net/t/is-findmarks-from-to-supposed-to-be-inclusive/844/3 "2016-07-29T15:40:52Z")

</div>

Okay thank you. Maybe consider updating the documentation to be more explicit about this?
