void OnBeginUndo (object sender, EventArgs args) { savedCaretPos = Caret.Location; savedSelection = MainSelection; }