I haven't been able to find another question about this but it would surprise me if no one ever wrote one, because it is so annoying. Also I'm not sure which tag to use because I cannot honestly tell if the current behavior is a bug or a feature.
So, okay, the text editor has its critics, it is not meant to be exactly an IDE but more of a paste-your-code-here box. Still, I cannot understand why the undo (Ctrl+Z) operation is so purposefully annoying. Here is something that has happened to me a number of times already:
- I write some text.
- I paste a piece of code and format it.
- I realize I need to make a couple of changes before posting it (e.g. rename a variable, remove a printing statement, etc.)
- I make a mistake while doing one of these small changes, so I press Ctrl+Z (this is muscle memory for me, which makes the next point extra annoying).
- Instead of undoing the last small change I did, all the code that I pasted and some of the text I wrote before disappears.
The worse part about this is that it has somehow intentionally been designed like that, because native browser undo/redo implementations (thankfully) do not work that way (breaking my expectations about the behavior of the action). The behavior is the same in the search text box but, interestingly, not in the question title text box, it seems.
Has anyone else noticed this?
I have tested this on Chrome and Firefox by the way.
Update:
I have made made a couple of screencasts showing this. Here is the behavior in an answer text box (similar in questions and search):
I write a bunch of stuff, press Ctrl+Z (note the "Redo" button gets active) and everything is gone. You can actually write way more but I think it is already clear.
For comparison, here is the behavior in comment boxes, which matches my expectation:
Here, each time I press undo only a few characters are removed.