Colour a fence, and draw a patch as the change it is
A fence is rendered beside the source it came from, by `@pierre/diffs` over Shiki, loaded on demand. The source stays where it was — Lexical text children under Yjs, editable by everyone at once — and the rendering is a second reading of it, never the document: the library's own edit mode would put a character model beside the one the room is collaborating in. A `diff` fence is a unified patch. It is repaired on the way to the renderer, because nobody writes a hunk header correctly and the counts in one are how a parser knows where the hunk ends: too low, and the change is truncated silently. What cannot be repaired is refused and drawn as coloured text, which is the honest rendering of something that was never a patch. A fence with no language draws nothing, so the language selector in the block's chrome is what turns a grey box into coloured code. Enter inside a fence is now a newline — it did nothing at all before, because Lexical asks a block to make its own successor and a code block cannot — and pressing it on a blank line leaves, which is the only way past a fence at the end of a plan.
Parent0763402
18 files changed+1331-60
StackedSplit