Premium

Text Editor with Undo and Redo: Edits, a Cursor and a History

By FrontendAtlas Editorial · Updated Nov 26, 2026

Challenge summary

Build a text buffer with a cursor, then give it undo and redo: record each edit so the text and the cursor can go back and forth, drop the redo history on a new edit and ignore edits that change nothing.

What you'll practice

  • Record each edit with what it removed, what it inserted and the cursor on both sides.
  • Walk a history with two stacks, and drop the redo stack when a new edit arrives.
  • Tell real edits from calls that change nothing, and cursor moves from edits.
  • Weigh recorded edits against whole snapshots for memory and speed.

What Premium unlocks

Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.

Free related practice

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.

Premium is $24 a month or $99 a year, less in many countries.