Adding to Advmemo Undolist

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()