comparison src/option.c @ 944:b2dcb8457067 v7.0.070

updated for version 7.0-070
author vimboss
date Tue, 29 Aug 2006 15:30:07 +0000
parents 94164a5b0626
children c06c658691e2
comparison
equal deleted inserted replaced
943:e70aad5761b5 944:b2dcb8457067
5266 int set_sid; 5266 int set_sid;
5267 { 5267 {
5268 char_u *s; 5268 char_u *s;
5269 char_u **varp; 5269 char_u **varp;
5270 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; 5270 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
5271 5271 int idx = opt_idx;
5272 if (opt_idx == -1) /* use name */ 5272
5273 { 5273 if (idx == -1) /* use name */
5274 opt_idx = findoption(name); 5274 {
5275 if (opt_idx < 0) /* not found (should not happen) */ 5275 idx = findoption(name);
5276 if (idx < 0) /* not found (should not happen) */
5276 { 5277 {
5277 EMSG2(_(e_intern2), "set_string_option_direct()"); 5278 EMSG2(_(e_intern2), "set_string_option_direct()");
5278 return; 5279 return;
5279 } 5280 }
5280 } 5281 }
5281 5282
5282 if (options[opt_idx].var == NULL) /* can't set hidden option */ 5283 if (options[idx].var == NULL) /* can't set hidden option */
5283 return; 5284 return;
5284 5285
5285 s = vim_strsave(val); 5286 s = vim_strsave(val);
5286 if (s != NULL) 5287 if (s != NULL)
5287 { 5288 {
5288 varp = (char_u **)get_varp_scope(&(options[opt_idx]), 5289 varp = (char_u **)get_varp_scope(&(options[idx]),
5289 both ? OPT_LOCAL : opt_flags); 5290 both ? OPT_LOCAL : opt_flags);
5290 if ((opt_flags & OPT_FREE) && (options[opt_idx].flags & P_ALLOCED)) 5291 if ((opt_flags & OPT_FREE) && (options[idx].flags & P_ALLOCED))
5291 free_string_option(*varp); 5292 free_string_option(*varp);
5292 *varp = s; 5293 *varp = s;
5293 5294
5294 /* For buffer/window local option may also set the global value. */ 5295 /* For buffer/window local option may also set the global value. */
5295 if (both) 5296 if (both)
5296 set_string_option_global(opt_idx, varp); 5297 set_string_option_global(idx, varp);
5297 5298
5298 options[opt_idx].flags |= P_ALLOCED; 5299 options[idx].flags |= P_ALLOCED;
5299 5300
5300 /* When setting both values of a global option with a local value, 5301 /* When setting both values of a global option with a local value,
5301 * make the local value empty, so that the global value is used. */ 5302 * make the local value empty, so that the global value is used. */
5302 if (((int)options[opt_idx].indir & PV_BOTH) && both) 5303 if (((int)options[idx].indir & PV_BOTH) && both)
5303 { 5304 {
5304 free_string_option(*varp); 5305 free_string_option(*varp);
5305 *varp = empty_option; 5306 *varp = empty_option;
5306 } 5307 }
5307 # ifdef FEAT_EVAL 5308 # ifdef FEAT_EVAL
5308 if (set_sid != SID_NONE) 5309 if (set_sid != SID_NONE)
5309 set_option_scriptID_idx(opt_idx, opt_flags, 5310 set_option_scriptID_idx(idx, opt_flags,
5310 set_sid == 0 ? current_SID : set_sid); 5311 set_sid == 0 ? current_SID : set_sid);
5311 # endif 5312 # endif
5312 } 5313 }
5313 } 5314 }
5314 5315