Fixes esc key in terminal mode.