davidbalbert / Watt

A high performance text editor for macOS.
MIT License
57 stars 2 forks source link

Make Spans a collection and replace AttributedRope.getAttributes #81

Open davidbalbert opened 1 year ago

davidbalbert commented 1 year ago

It would be nice if Spans conformed to Collection. If we did that, AttributedRope.Runs could also be a Collection, and we could replace r.getAttributes(at: r(after: r.startIndex)) with r.runs[r.index(after: r.startIndex)].attributes which is the same API that AttributedString uses.

We could take inspiration from the design of AttributedString.Runs for both Spans and AttributedRope.Runs.

Specifically: