codespan icon indicating copy to clipboard operation
codespan copied to clipboard

Consider modelling spans with RangeInclusive

Open 414owen opened this issue 1 year ago • 1 comments

Currently labels are positioned in the text buffer using a Range<L>. This means it's impossible to represent a label that runs until the end of the text buffer of length L::MAX, because of wraparound. I also don't see the point of modelling a zero-width span, so RangeInclusive seems like a much tighter fit for this use-case. We can make invalid states unrepresentable, here.

414owen avatar Dec 22 '24 11:12 414owen

A zero-width span just represents an insertion point (similar to a text editor cursor), and those could theoretically be useful when an error is of the kind "something is missing from here, please insert it".

(although displaying that on a terminal is technically equivalent to a width 1 span anyway, since the caret can not be positioned between cells... but for IDE navigation it's still different)

jaens avatar Apr 10 '25 17:04 jaens