**To reproduce:** 1. Go to http://www.gopherjs.org/playground 2. De-indent the three lines in main 3. Press "Format" 4. Ctrl-Z repeatedly **What I see:** Corrupted text. **What I want to see:** Ctrl+Z undoes formatting, then continues to undo previous operations. /cc @francesc