Cursor Preservation Across Buffer Rewrites

When you erase and redraw a buffer, cursor position is lost. The naive fix—save and restore point—breaks when content changes. Here's how I arrived at a robust solution through iteration.