* modifyOtherKeys level 2 is enabled or the kitty keyboard protocol is
* enabled.
*/
- static int
+ int
key_protocol_enabled(void)
{
// If xterm has responded to XTQMODKEYS it overrules seenModifyOtherKeys.
void f_getcharstr(typval_T *argvars, typval_T *rettv);
void f_getcharmod(typval_T *argvars, typval_T *rettv);
void parse_queued_messages(void);
+int key_protocol_enabled(void);
void vungetc(int c);
int fix_input_buffer(char_u *buf, int len);
int input_available(void);
// If a CTRL-C was typed, remove it from the buffer and set
// got_int. Also recognize CTRL-C with modifyOtherKeys set, lower
// and upper case, in two forms.
- if (ctrl_c_interrupts && (inbuf[inbufcount] == 3
+ // If terminal key protocols are in use, we expect to receive
+ // Ctrl_C as an escape sequence, ignore a raw Ctrl_C as this could
+ // be paste data.
+ if (ctrl_c_interrupts
+ && ((inbuf[inbufcount] == Ctrl_C && !key_protocol_enabled())
|| (len >= 10 && STRNCMP(inbuf + inbufcount,
"\033[27;5;99~", 10) == 0)
|| (len >= 10 && STRNCMP(inbuf + inbufcount,