This is the core of the Atom text buffer, separated into its own module so its tests can be run headless. It handles the storage and manipulation of text and associated regions (markers).
Sick of boring JavaScript newsletters?
Bytes is a JavaScript newsletter you'll actually enjoy reading.