Add undo functionality for CTRL+U and CTRL+W