My text editor allows me to undo several steps (Ctrl+Z)... as many as like ... 25 or more. Undo several times to get back to where you wanted, copy out the piece you wanted to another document (temp), then redo (Ctrl+R) several times to bring everything back to where you were when you realized you screwed up.