public void Undo(ITextBuffer target) { if (!done) throw new InvalidOperationException("Command is already unapplied."); target.SetCarets(after); target.ReplaceText(textBefore, false); target.SetCarets(before); done = false; }
public void Do(ITextBuffer target) { if (done) throw new InvalidOperationException("Command is already applied."); target.SetCarets(before); target.ReplaceText(textAfter, autoIndent); after = target.GetCarets(); target.Mark = target.Point; done = true; }