Clear undo stack after typing. Fixes #3074