Fix behavior after Esc mapping in terminal