Added copy/paste support.

Couldn't get real access to the clipboard, so we can only copy/paste
within one instance of the app, at the moment.

Also fixed a few undo/redo bugs:
-- after undo/redo, invalid keys were still selected and showing in the
editor
-- A number of transactions didn't do anything, but invoking them would
empty the redo stack; now checking for these conditions before logging
the transaction.
-- Limiting the undo stack to 32 levels, for performance/memory reasons.