Closed andrewconlan closed 4 years ago
Thanks so much for opening this issue and providing a reproducible test case, @andrewconlan. This looks to be a bug in cmark, as cmark_node_get_start_column
is reporting a position after cmark_node_get_end_column
. I'll investigate this some more and open some issues / PRs in that project.
In the meantime, I can think of a few possible workarounds:
range
property with constituent startPosition
and endPosition
properties, adding a note about there being no guarantees for those to form a valid rangerange
property optional; if no valid range can be formed, it returns nil
.range
would have a column range of 3...3
.Of these options, I'm leaning on #3, because that would provide a fix without changing the public API. Do you have any strong feelings about the best way to resolve this?
Yep I think number #3 sounds like a good solution until it's resolved in cmark, I'm using the project to add attributes to a UITextView as the user types and it's working really well, thanks again for the project, it's excellent
Thanks again for reporting this, @andrewconlan. The fix in #2 is now merged and available in version 0.2.2.
Seem to be running into an issue when adding a header to a list "* #" or quote "> #", then checking the range for that header:
Fatal error: Can't form Range with upperBound < lowerBound
I've added a test project, to show it happening test.zip