Give me some thoughts how to implement undo/redo functionality - like we have in text editors.
What algorithms should I use and what I may read. thanks.
There are several ways to do this, but you could start looking at the Command pattern. Use a list of commands to move back (Undo) or forward (redo) through your actions. An example in C# can be found here.