Adding to Advmemo Undolist

I have a function that adds "" to the beginning of selected lines. Because I am manipulating the memo contents programmatically, the undolist does not have entries for the changes. I have spent a fair amount of time looking at the the various TUndo descendents but can't figure out out to add the changes to the undo list. Can you point me in the right direction? The code for the function is below:

procedure TEditForm.CommentExecute(Sender: TObject);
  I, Temp, SelStart, SelEnd: Integer;
  SelStart := Memo1.SelStartY;
  SelEnd := Memo1.SelEndY;
  if SelStart > SelEnd then
    Temp := SelEnd;
    SelEnd := SelStart;
    SelStart := Temp;
  for I := SelStart to SelEnd do
    Memo1.Lines := '' + Memo1.Lines;

Also, I have some functions that use the Memo.Lines.Insert() to replace selected text. Could you also point me in the right direction on adding changes made in that manner to the undolist?

Thank you very much!

Directly manipulating AdvMemo.Lines is indeed not tracked by the undo buffer (by design).
To insert text tracked by the undo buffer, please use AdvMemo.InsertText()