Added check of whether undo/redo can be done in, respectively, undo- and
redo command.

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