I finally figured out why the text editor sometimes behaves unexpectedly. Basically it doesn't consider cut or paste as undoable operations. So, if I cut something, there is no entry in the undo stack, and if I paste, it doesn't count as undoable either.
This is a problem in weird cases, like say you do the following operations:
- Format text via CTRL+K
- Cut out several lines of text via CTRL+X
- Paste in some foreign text.
- Hit UNDO to remove that foreign text.
- Suddenly you are back at step 1), where you just formatted the text.
Many other scenarios are possible. Kinda frustrating.
Related: