Added comments about the logic of undo history handler.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>