How does Undo work in a text editor?
Edit>Undo (shortcut: C+z ) reverses the most recent editing command. For example, this can be used to restore unintentionally deleted text. More complicated operations, such as a search and replace, can also be undone. If you undo too many changes, Edit>Redo (shortcut: C+e C+z ) can restore the changes again.