CRichText tweaks
mweidner037 opened this issue · comments
- Rewrite internals to use before and after positions between characters, instead of "normal" vs "endClosed" spans. This would make the implementation more in line with Peritext, and allow us to have open-start spans.
- A closed-start span overlapping a longer span makes the latter's second half be open-start.
- Describe endpoint behavior in terms of
expand?: 'before' | 'after' | 'both' | 'none'
instead of open/closed endpoints. This idea comes from Automerge's API. - As a saved state optimization, use reference counting to detect when spans are no longer relevant (completely overwritten), then delete them from the
CSpanLog
. This is especially helpful if you store embeds as a special formatting span on a dummy char: once the char is deleted, the span (hence embed data) will be deleted.
More generally:
- Split formatting from the text itself, so you can also apply formatting to e.g. spreadsheet rows/columns.
- Can we make formatting work for suggestions / sharded lists (cf #264)?