patch 9.0.1330: handling new value of an option has a long "else if" chain
Problem: Handling new value of an option has a long "else if" chain.
Solution: Use a function pointer. (Yegappan Lakshmanan, closes #12015)
diff --git a/src/structs.h b/src/structs.h
index a320d70..584d472 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -4789,3 +4789,33 @@
#endif
int cts_vcol; // virtual column at current position
} chartabsize_T;
+
+/*
+ * Argument for the callback function (opt_did_set_cb_T) invoked after an
+ * option value is modified.
+ */
+typedef struct
+{
+ 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
+ {
+ long number;
+ int boolean;
+ char_u *string;
+ } os_oldval;
+
+ // new value of the option (can be a string, number or a boolean)
+ union
+ {
+ long number;
+ int boolean;
+ char_u *string;
+ } os_newval;
+
+ // When set by the called function: Stop processing the option further.
+ // Currently only used for boolean options.
+ int os_doskip;
+} optset_T;