Building a tiny text editor in Go, part 2: the simplest undo
·844 words·4 mins
Undo sounds mysterious until we pick a deliberately unsophisticated answer: copy the whole document before every edit. It is easy to understand, and its cost shows what to improve next.