Add preview for the input panel

Automatically updates and cleans up undo stack (works on cancel too).

Also fixes a regression with alpha mode.