patch 9.0.1374: function for setting options not used consistently

Problem:    Function for setting options not used consistently.
Solution:   Use a function for 'encoding' and terminal options. (Yegappan
            Lakshmanan, closes #12099)
diff --git a/src/structs.h b/src/structs.h
index d020449..46a71cb 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -4797,8 +4797,11 @@
  */
 typedef struct
 {
+    // Pointer to the option variable.  The variable can be a long (numeric
+    // option), an int (boolean option) or a char pointer (string option).
+    char_u	*os_varp;
+    int		os_idx;
     int		os_flags;
-    char_u	*os_varp;		// pointer to the option variable
 
     // old value of the option (can be a string, number or a boolean)
     union
@@ -4831,6 +4834,11 @@
     // option and need to be restored because of a failure.
     int		os_restore_chartab;
 
+#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
+    // Used by the 't_xxx' terminal options on MS-Windows.
+    int		os_did_swaptcap;
+#endif
+
     // If the value specified for an option is not valid and the error message
     // is parameterized, then the "os_errbuf" buffer is used to store the error
     // message (when it is not NULL).