0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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...
This commit is contained in:
Bram Moolenaar 2015-08-25 15:39:55 +02:00
parent be83b73ddb
commit e68c25c677
2 changed files with 76 additions and 46 deletions

View File

@ -3079,6 +3079,7 @@ static void did_set_title __ARGS((int icon));
#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, const void *b));
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_value_alloced, oldval, errbuf,
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

View File

@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
833,
/**/
832,
/**/