Figma Document Buffer
Also known as: Text Buffer with Undo/Redo
Figma Document Buffer (Part 1) - insert(position, text) - delete(position, length) - get_text() -> str Rules: - positions are 0-indexed - out-of-bounds positions clip to the nearest valid boundary - insert inserts BEFORE the character currently at position - delete removes up to length characters (clipped by end of document)
Implement a text buffer with insert/delete plus undo/redo. The core trap is that undoing deletes/replaces requires remembering exactly what text was removed.

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.
Each locked part opens in the editor once the part before it passes.