Mercurial > vim
changeset 7040:17a3fa77e941 v7.4.833
commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 25 15:39:55 2015 +0200
patch 7.4.833
Problem: More side effects of ":set all&" are missing. (Bj?rn Linse)
Solution: Call didset_options() and add didset_options2() to collect more
side effects to take care of. Still not everything...
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 25 Aug 2015 17:20:27 +0200 |
parents | 338aa8cac96d |
children | 0c84d2003fa6 |
files | src/option.c src/version.c |
diffstat | 2 files changed, 76 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -3079,6 +3079,7 @@ static void did_set_title __ARGS((int ic #endif static char_u *option_expand __ARGS((int opt_idx, char_u *val)); static void didset_options __ARGS((void)); +static void didset_options2 __ARGS((void)); static void check_string_option __ARGS((char_u **pp)); #if defined(FEAT_EVAL) || defined(PROTO) static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags)); @@ -3096,6 +3097,7 @@ static int int_cmp __ARGS((const void *a static char_u *check_clipboard_option __ARGS((void)); #endif #ifdef FEAT_SPELL +static char_u *did_set_spell_option __ARGS((int is_spellfile)); static char_u *compile_cap_prog __ARGS((synblock_T *synblock)); #endif #ifdef FEAT_EVAL @@ -3376,17 +3378,11 @@ set_init_1() didset_options(); #ifdef FEAT_SPELL - /* Use the current chartab for the generic chartab. */ + /* Use the current chartab for the generic chartab. This is not in + * didset_options() because it only depends on 'encoding'. */ init_spell_chartab(); #endif -#ifdef FEAT_LINEBREAK - /* - * initialize the table for 'breakat'. - */ - fill_breakat_flags(); -#endif - /* * Expand environment variables and things like "~" for the defaults. * If option_expand() returns non-NULL the variable is expanded. This can @@ -3418,14 +3414,8 @@ set_init_1() } } - /* Initialize the highlight_attr[] table. */ - highlight_changed(); - save_file_ff(curbuf); /* Buffer is unchanged */ - /* Parse default for 'wildmode' */ - check_opt_wim(); - #if defined(FEAT_ARABIC) /* Detect use of mlterm. * Mlterm is a terminal emulator akin to xterm that has some special @@ -3437,15 +3427,7 @@ set_init_1() set_option_value((char_u *)"tbidi", 1L, NULL, 0); #endif -#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) - /* Parse default for 'fillchars'. */ - (void)set_chars_option(&p_fcs); -#endif - -#ifdef FEAT_CLIPBOARD - /* Parse default for 'clipboard' */ - (void)check_clipboard_option(); -#endif + didset_options2(); #ifdef FEAT_MBYTE # if defined(WIN3264) && defined(FEAT_GETTEXT) @@ -3670,7 +3652,10 @@ set_options_default(opt_flags) for (i = 0; !istermoption(&options[i]); i++) if (!(options[i].flags & P_NODEFAULT) - && (opt_flags == 0 || options[i].var != (char_u *)&p_enc)) + && (opt_flags == 0 + || (options[i].var != (char_u *)&p_enc + && options[i].var != (char_u *)&p_cm + && options[i].var != (char_u *)&p_key))) set_option_default(i, opt_flags, p_cp); #ifdef FEAT_WINDOWS @@ -4206,6 +4191,8 @@ do_set(arg, opt_flags) ++arg; /* Only for :set command set global value of local options. */ set_options_default(OPT_FREE | opt_flags); + didset_options(); + didset_options2(); redraw_all_later(CLEAR); } else @@ -5348,6 +5335,7 @@ didset_options() (void)spell_check_msm(); (void)spell_check_sps(); (void)compile_cap_prog(curwin->w_s); + (void)did_set_spell_option(TRUE); #endif #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE); @@ -5362,6 +5350,35 @@ didset_options() #ifdef FEAT_LINEBREAK briopt_check(curwin); #endif +#ifdef FEAT_LINEBREAK + /* initialize the table for 'breakat'. */ + fill_breakat_flags(); +#endif + +} + +/* + * More side effects of setting options. + */ + static void +didset_options2() +{ + /* Initialize the highlight_attr[] table. */ + (void)highlight_changed(); + + /* Parse default for 'wildmode' */ + check_opt_wim(); + + (void)set_chars_option(&p_lcs); +#if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) + /* Parse default for 'fillchars'. */ + (void)set_chars_option(&p_fcs); +#endif + +#ifdef FEAT_CLIPBOARD + /* Parse default for 'clipboard' */ + (void)check_clipboard_option(); +#endif } /* @@ -6794,28 +6811,7 @@ did_set_string_option(opt_idx, varp, new else if (varp == &(curwin->w_s->b_p_spl) || varp == &(curwin->w_s->b_p_spf)) { - win_T *wp; - int l; - - if (varp == &(curwin->w_s->b_p_spf)) - { - l = (int)STRLEN(curwin->w_s->b_p_spf); - if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4, - ".add") != 0)) - errmsg = e_invarg; - } - - if (errmsg == NULL) - { - FOR_ALL_WINDOWS(wp) - if (wp->w_buffer == curbuf && wp->w_p_spell) - { - errmsg = did_set_spelllang(wp); -# ifdef FEAT_WINDOWS - break; -# endif - } - } + errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf)); } /* When 'spellcapcheck' is set compile the regexp program. */ else if (varp == &(curwin->w_s->b_p_spc)) @@ -7687,6 +7683,36 @@ check_clipboard_option() #endif #ifdef FEAT_SPELL + static char_u * +did_set_spell_option(is_spellfile) + int is_spellfile; +{ + char_u *errmsg = NULL; + win_T *wp; + int l; + + if (is_spellfile) + { + l = (int)STRLEN(curwin->w_s->b_p_spf); + if (l > 0 && (l < 4 + || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) + errmsg = e_invarg; + } + + if (errmsg == NULL) + { + FOR_ALL_WINDOWS(wp) + if (wp->w_buffer == curbuf && wp->w_p_spell) + { + errmsg = did_set_spelllang(wp); +# ifdef FEAT_WINDOWS + break; +# endif + } + } + return errmsg; +} + /* * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. * Return error message when failed, NULL when OK. @@ -11741,6 +11767,7 @@ vimrc_found(fname, envname) if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF))) set_option_default(opt_idx, OPT_FREE, FALSE); didset_options(); + didset_options2(); } if (fname != NULL) @@ -11829,6 +11856,7 @@ compatible_set() || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp)) set_option_default(opt_idx, OPT_FREE, p_cp); didset_options(); + didset_options2(); } #ifdef FEAT_LINEBREAK