]> granicus.if.org Git - vim/commitdiff
patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd v8.1.0414
authorBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2018 09:59:32 +0000 (11:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2018 09:59:32 +0000 (11:59 +0200)
Problem:    v:option_old and v:option_new are cleared when using :set in
            OptionSet autocmd. (Gary Johnson)
Solution:   Don't trigger OptionSet recursively.

src/option.c
src/version.c

index 818e6911cd0842a63e88576e51e3118d8f74052b..763aab07a62f57a687a57aeb4557d153f9ce2cb3 100644 (file)
@@ -4359,7 +4359,9 @@ trigger_optionsset_string(
        char_u *oldval,
        char_u *newval)
 {
-    if (oldval != NULL && newval != NULL)
+    // Don't do this recursively.
+    if (oldval != NULL && newval != NULL
+                                   && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
     {
        char_u buf_type[7];
 
@@ -8858,9 +8860,11 @@ set_bool_option(
     options[opt_idx].flags |= P_WAS_SET;
 
 #if defined(FEAT_EVAL)
-    if (!starting)
+    // Don't do this while starting up or recursively.
+    if (!starting && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
     {
        char_u buf_old[2], buf_new[2], buf_type[7];
+
        vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
        vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
        vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
@@ -9415,7 +9419,8 @@ set_num_option(
     options[opt_idx].flags |= P_WAS_SET;
 
 #if defined(FEAT_EVAL)
-    if (!starting && errmsg == NULL)
+    // Don't do this while starting up, failure or recursively.
+    if (!starting && errmsg == NULL && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
     {
        char_u buf_old[11], buf_new[11], buf_type[7];
        vim_snprintf((char *)buf_old, 10, "%ld", old_value);
index 0e20abf55a55d5bbc60d46a327e18230c9f4a27f..3ce73b9ea247fbe195d5ad3587525226b8004474 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    414,
 /**/
     413,
 /**/