patch 9.0.1957: termcap options should change when setting keyprotocol

Problem:  termcap options should change on keyprotocol setting
Solution: Apply termcap entries when 'keyprotocol' changes

When the 'keyprotocol' option was set after startup (including in a
user's .vimrc) the termcap entries associated with the matching protocol
were not applied. Thus, setting the option has no affect.

When 'keyprotocol' is changed it should also update the termcap entries.

closes: #13211

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Gregory Anders <greg@gpanders.com>
diff --git a/src/optionstr.c b/src/optionstr.c
index 5fceb85..9b4464d 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -1945,9 +1945,13 @@
     char *
 did_set_keyprotocol(optset_T *args UNUSED)
 {
-    if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL)
+    char_u *term = T_NAME;
+    keyprot_T kpc = match_keyprotocol(term);
+    if (kpc == KEYPROTOCOL_FAIL)
 	return e_invalid_argument;
 
+    apply_keyprotocol(term, kpc);
+
     return NULL;
 }