properly handle esc and return.