Skip to lesson
Exit
Applied Coding & Editor Primitives1 / 2

2 min lesson

Text buffers and edit primitives

Work through the cases in "Text buffers and edit primitives", pairing each signal with the move that fits.

Step 1 of 2

An editor is a machine for inserting and deleting characters in huge documents, fast. The naive answer - a single string you keep re-slicing - collapses the moment a file is large or edits are frequent.

Beyond the naive flat string, three representations come up. You rarely have to implement a rope from scratch in a 45-minute screen, but you must be able to name them, sketch one and reason about why an editor picks the one it does.

WHY EDITORS PICK ROPES

Interactive diagram. Tab through its regions; each focused region shows its detail in the panel below.

diagram: quadrant

Every representation trades edit cost against random-access cost; the upper-right corner is what scales.