patch 8.2.0970: terminal properties are not available in Vim script

Problem:    Terminal properties are not available in Vim script.
Solution:   Add the terminalprops() function.
diff --git a/src/term.c b/src/term.c
index 82b1126..e75fddb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1470,7 +1470,7 @@
  * When "all" is FALSE only set those that are detected from the version
  * response.
  */
-    static void
+    void
 init_term_props(int all)
 {
     int i;
@@ -1490,6 +1490,29 @@
 }
 #endif
 
+#if defined(FEAT_EVAL) || defined(PROTO)
+    void
+f_terminalprops(typval_T *argvars UNUSED, typval_T *rettv)
+{
+# ifdef FEAT_TERMRESPONSE
+    int i;
+# endif
+
+    if (rettv_dict_alloc(rettv) != OK)
+	return;
+# ifdef FEAT_TERMRESPONSE
+    for (i = 0; i < TPR_COUNT; ++i)
+    {
+	char_u	value[2];
+
+	value[0] = term_props[i].tpr_status;
+	value[1] = NUL;
+	dict_add_string(rettv->vval.v_dict, term_props[i].tpr_name, value);
+    }
+# endif
+}
+#endif
+
     static struct builtin_term *
 find_builtin_term(char_u *term)
 {
@@ -3676,8 +3699,6 @@
 {
     int	    did_send = FALSE;
 
-    init_term_props(TRUE);
-
     if (!can_get_termresponse() || starting != 0 || *T_U7 == NUL)
 	return;
 
@@ -4516,7 +4537,8 @@
 
     // Reset terminal properties that are set based on the termresponse.
     // Mainly useful for tests that send the termresponse multiple times.
-    init_term_props(FALSE);
+    // For testing all props can be reset.
+    init_term_props(reset_term_props_on_termresponse);
 
     // If this code starts with CSI, you can bet that the
     // terminal uses 8-bit codes.