patch 9.0.1287: with the Kitty key protocl Esc with NumLock cannot be mapped

Problem:    With the Kitty key protocl Esc with NumLock cannot be mapped.
Solution:   Also use K_ESC when there is a modifier. (closes #11811)
diff --git a/src/term.c b/src/term.c
index d7cece3..c90efe5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5349,6 +5349,11 @@
     if ((modifiers & MOD_MASK_SHIFT) && key >= 'a' && key <= 'z')
 	key += 'A' - 'a';
 
+    // Putting Esc in the buffer creates ambiguity, it can be the start of an
+    // escape sequence.  Use K_ESC to avoid that.
+    if (key == ESC)
+	key = K_ESC;
+
     return put_key_modifiers_in_typebuf(key, modifiers,
 					csi_len, offset, buf, bufsize, buflen);
 }