gopherjs / gopherjs.github.io

GopherJS Playground
https://gopherjs.github.io/playground/
23 stars 12 forks source link

Format button breaks undo #54

Open broady opened 8 years ago

broady commented 8 years ago

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

dmitshur commented 8 years ago

Thanks for reporting this with clear reproduce steps.

I can reproduce this both on http://www.gopherjs.org/playground/ AND on https://play.golang.org/ in latest stable version of Chrome.

image

The code for applying formatting is very straightforward, it simply overwrites the entire