@@ -3254,6 +3254,8 @@ static struct vimoption options[] =
32543254 p_term ("t_AL" , T_CAL )
32553255 p_term ("t_al" , T_AL )
32563256 p_term ("t_bc" , T_BC )
3257+ p_term ("t_BE" , T_BE )
3258+ p_term ("t_BD" , T_BD )
32573259 p_term ("t_cd" , T_CD )
32583260 p_term ("t_ce" , T_CE )
32593261 p_term ("t_cl" , T_CL )
@@ -3270,13 +3272,11 @@ static struct vimoption options[] =
32703272 p_term ("t_db" , T_DB )
32713273 p_term ("t_DL" , T_CDL )
32723274 p_term ("t_dl" , T_DL )
3275+ p_term ("t_EC" , T_CEC )
32733276 p_term ("t_EI" , T_CEI )
32743277 p_term ("t_fs" , T_FS )
3278+ p_term ("t_GP" , T_CGP )
32753279 p_term ("t_IE" , T_CIE )
3276- p_term ("t_SC" , T_CSC )
3277- p_term ("t_EC" , T_CEC )
3278- p_term ("t_SH" , T_CSH )
3279- p_term ("t_RS" , T_CRS )
32803280 p_term ("t_IS" , T_CIS )
32813281 p_term ("t_ke" , T_KE )
32823282 p_term ("t_ks" , T_KS )
@@ -3290,10 +3290,13 @@ static struct vimoption options[] =
32903290 p_term ("t_op" , T_OP )
32913291 p_term ("t_RB" , T_RBG )
32923292 p_term ("t_RI" , T_CRI )
3293+ p_term ("t_RS" , T_CRS )
32933294 p_term ("t_RV" , T_CRV )
32943295 p_term ("t_Sb" , T_CSB )
3296+ p_term ("t_SC" , T_CSC )
32953297 p_term ("t_se" , T_SE )
32963298 p_term ("t_Sf" , T_CSF )
3299+ p_term ("t_SH" , T_CSH )
32973300 p_term ("t_SI" , T_CSI )
32983301 p_term ("t_so" , T_SO )
32993302 p_term ("t_SR" , T_CSR )
@@ -3308,18 +3311,16 @@ static struct vimoption options[] =
33083311 p_term ("t_vb" , T_VB )
33093312 p_term ("t_ve" , T_VE )
33103313 p_term ("t_vi" , T_VI )
3314+ p_term ("t_VS" , T_CVS )
33113315 p_term ("t_vs" , T_VS )
33123316 p_term ("t_WP" , T_CWP )
3313- p_term ("t_GP" , T_CGP )
33143317 p_term ("t_WS" , T_CWS )
33153318 p_term ("t_xn" , T_XN )
33163319 p_term ("t_xs" , T_XS )
33173320 p_term ("t_ZH" , T_CZH )
33183321 p_term ("t_ZR" , T_CZR )
33193322 p_term ("t_8f" , T_8F )
33203323 p_term ("t_8b" , T_8B )
3321- p_term ("t_BE" , T_BE )
3322- p_term ("t_BD" , T_BD )
33233324
33243325/* terminal key codes are not in here */
33253326
@@ -4468,8 +4469,6 @@ trigger_optionsset_string(
44684469 (char_u * )options [opt_idx ].fullname , NULL , FALSE, NULL );
44694470 reset_v_option_vars ();
44704471 }
4471- vim_free (oldval );
4472- vim_free (newval );
44734472}
44744473#endif
44754474
@@ -4935,19 +4934,19 @@ do_set(
49354934 }
49364935 else if (opt_idx >= 0 ) /* string */
49374936 {
4938- char_u * save_arg = NULL ;
4939- char_u * s = NULL ;
4940- char_u * oldval = NULL ; /* previous value if *varp */
4941- char_u * newval ;
4942- char_u * origval = NULL ;
4937+ char_u * save_arg = NULL ;
4938+ char_u * s = NULL ;
4939+ char_u * oldval = NULL ; /* previous value if *varp */
4940+ char_u * newval ;
4941+ char_u * origval = NULL ;
49434942#if defined(FEAT_AUTOCMD ) && defined(FEAT_EVAL )
4944- char_u * saved_origval = NULL ;
4945- char_u * saved_newval = NULL ;
4943+ char_u * saved_origval = NULL ;
4944+ char_u * saved_newval = NULL ;
49464945#endif
4947- unsigned newlen ;
4948- int comma ;
4949- int bs ;
4950- int new_value_alloced ; /* new string option
4946+ unsigned newlen ;
4947+ int comma ;
4948+ int bs ;
4949+ int new_value_alloced ; /* new string option
49514950 was allocated */
49524951
49534952 /* When using ":set opt=val" for a global option
@@ -4960,6 +4959,16 @@ do_set(
49604959 /* The old value is kept until we are sure that the
49614960 * new value is valid. */
49624961 oldval = * (char_u * * )varp ;
4962+
4963+ /* When setting the local value of a global
4964+ * option, the old value may be the global value. */
4965+ if (((int )options [opt_idx ].indir & PV_BOTH )
4966+ && (opt_flags & OPT_LOCAL ))
4967+ origval = * (char_u * * )get_varp (
4968+ & options [opt_idx ]);
4969+ else
4970+ origval = oldval ;
4971+
49634972 if (nextchar == '&' ) /* set to default val */
49644973 {
49654974 newval = options [opt_idx ].def_val [
@@ -5036,6 +5045,8 @@ do_set(
50365045 break ;
50375046 }
50385047 vim_free (oldval );
5048+ if (origval == oldval )
5049+ origval = * (char_u * * )varp ;
50395050 oldval = * (char_u * * )varp ;
50405051 }
50415052 /*
@@ -5074,15 +5085,6 @@ do_set(
50745085 ++ arg ;
50755086 }
50765087
5077- /* When setting the local value of a global
5078- * option, the old value may be the global value. */
5079- if (((int )options [opt_idx ].indir & PV_BOTH )
5080- && (opt_flags & OPT_LOCAL ))
5081- origval = * (char_u * * )get_varp (
5082- & options [opt_idx ]);
5083- else
5084- origval = oldval ;
5085-
50865088 /*
50875089 * Copy the new string into allocated memory.
50885090 * Can't use set_string_option_direct(), because
@@ -5286,7 +5288,9 @@ do_set(
52865288 new_value_alloced = TRUE;
52875289 }
52885290
5289- /* Set the new value. */
5291+ /*
5292+ * Set the new value.
5293+ */
52905294 * (char_u * * )(varp ) = newval ;
52915295
52925296#if defined(FEAT_AUTOCMD ) && defined(FEAT_EVAL )
@@ -5312,19 +5316,16 @@ do_set(
53125316 errmsg = did_set_string_option (opt_idx , (char_u * * )varp ,
53135317 new_value_alloced , oldval , errbuf , opt_flags );
53145318
5315- /* If error detected, print the error message. */
5316- if (errmsg != NULL )
5317- {
53185319#if defined(FEAT_AUTOCMD ) && defined(FEAT_EVAL )
5319- vim_free (saved_origval );
5320- vim_free (saved_newval );
5321- #endif
5322- goto skip ;
5323- }
5324- #if defined(FEAT_AUTOCMD ) && defined(FEAT_EVAL )
5325- trigger_optionsset_string (opt_idx , opt_flags ,
5320+ if (errmsg == NULL )
5321+ trigger_optionsset_string (opt_idx , opt_flags ,
53265322 saved_origval , saved_newval );
5323+ vim_free (saved_origval );
5324+ vim_free (saved_newval );
53275325#endif
5326+ /* If error detected, print the error message. */
5327+ if (errmsg != NULL )
5328+ goto skip ;
53285329 }
53295330 else /* key code option */
53305331 {
@@ -6135,8 +6136,11 @@ set_string_option(
61356136
61366137#if defined(FEAT_AUTOCMD ) && defined(FEAT_EVAL )
61376138 /* call autocommand after handling side effects */
6138- trigger_optionsset_string (opt_idx , opt_flags ,
6139+ if (r == NULL )
6140+ trigger_optionsset_string (opt_idx , opt_flags ,
61396141 saved_oldval , saved_newval );
6142+ vim_free (saved_oldval );
6143+ vim_free (saved_newval );
61406144#endif
61416145 }
61426146 return r ;
0 commit comments