* get a character: 3. from the user - handle <Esc> in Insert mode
*/
/*
- * Special case: if we get an <ESC> in insert mode and there
+ * Special case: if we get an <ESC> in Insert mode and there
* are no more characters at once, we pretend to go out of
- * insert mode. This prevents the one second delay after
+ * Insert mode. This prevents the one second delay after
* typing an <ESC>. If we get something after all, we may
* have to redisplay the mode. That the cursor is in the wrong
* place does not matter.
+ * Do not do this if the kitty keyboard protocol is used, every
+ * <ESC> is the start of an escape sequence then.
*/
c = 0;
new_wcol = curwin->w_wcol;
&& typebuf.tb_len == 1
&& typebuf.tb_buf[typebuf.tb_off] == ESC
&& !no_mapping
+ && kitty_protocol_state != KKPS_ENABLED
&& ex_normal_busy == 0
&& typebuf.tb_maplen == 0
&& (State & MODE_INSERT)