comparison src/option.c @ 1622:149d8b46404c

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 22:09:24 +0000
parents eef96cfdbbbe
children 131dbd3d2a4b
comparison
equal deleted inserted replaced
1621:82b5078be2dd 1622:149d8b46404c
2844 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL}; 2844 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
2845 #endif 2845 #endif
2846 #ifdef FEAT_SCROLLBIND 2846 #ifdef FEAT_SCROLLBIND
2847 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL}; 2847 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
2848 #endif 2848 #endif
2849 static char *(p_swb_values[]) = {"useopen", "usetab", "split", NULL};
2850 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; 2849 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
2851 #ifdef FEAT_VERTSPLIT 2850 #ifdef FEAT_VERTSPLIT
2852 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; 2851 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
2853 #endif 2852 #endif
2854 #if defined(FEAT_QUICKFIX) 2853 #if defined(FEAT_QUICKFIX)
3274 vim_setenv("LANG", buf); 3273 vim_setenv("LANG", buf);
3275 } 3274 }
3276 } 3275 }
3277 # else 3276 # else
3278 # ifdef MACOS_CONVERT 3277 # ifdef MACOS_CONVERT
3279 if (mch_getenv((char_u *)"LANG") == NULL) 3278 /* Moved to os_mac_conv.c to avoid dependency problems. */
3280 { 3279 mac_lang_init();
3281 char buf[20];
3282 if (LocaleRefGetPartString(NULL,
3283 kLocaleLanguageMask | kLocaleLanguageVariantMask |
3284 kLocaleRegionMask | kLocaleRegionVariantMask,
3285 sizeof buf, buf) == noErr && *buf)
3286 {
3287 vim_setenv((char_u *)"LANG", (char_u *)buf);
3288 # ifdef HAVE_LOCALE_H
3289 setlocale(LC_ALL, "");
3290 # endif
3291 }
3292 }
3293 # endif 3280 # endif
3294 # endif 3281 # endif
3295 3282
3296 /* enc_locale() will try to find the encoding of the current locale. */ 3283 /* enc_locale() will try to find the encoding of the current locale. */
3297 p = enc_locale(); 3284 p = enc_locale();
4597 mch_memmove(newval, origval, (size_t)i); 4584 mch_memmove(newval, origval, (size_t)i);
4598 } 4585 }
4599 else 4586 else
4600 { 4587 {
4601 i = (int)STRLEN(newval); 4588 i = (int)STRLEN(newval);
4602 mch_memmove(newval + i + comma, origval, 4589 STRMOVE(newval + i + comma, origval);
4603 STRLEN(origval) + 1);
4604 } 4590 }
4605 if (comma) 4591 if (comma)
4606 newval[i] = ','; 4592 newval[i] = ',';
4607 } 4593 }
4608 4594
4627 /* include comma before string */ 4613 /* include comma before string */
4628 --s; 4614 --s;
4629 ++i; 4615 ++i;
4630 } 4616 }
4631 } 4617 }
4632 mch_memmove(newval + (s - origval), s + i, 4618 STRMOVE(newval + (s - origval), s + i);
4633 STRLEN(s + i) + 1);
4634 } 4619 }
4635 } 4620 }
4636 4621
4637 if (flags & P_FLAGLIST) 4622 if (flags & P_FLAGLIST)
4638 { 4623 {
4639 /* Remove flags that appear twice. */ 4624 /* Remove flags that appear twice. */
4640 for (s = newval; *s; ++s) 4625 for (s = newval; *s; ++s)
4641 if ((!(flags & P_COMMA) || *s != ',') 4626 if ((!(flags & P_COMMA) || *s != ',')
4642 && vim_strchr(s + 1, *s) != NULL) 4627 && vim_strchr(s + 1, *s) != NULL)
4643 { 4628 {
4644 mch_memmove(s, s + 1, STRLEN(s)); 4629 STRMOVE(s, s + 1);
4645 --s; 4630 --s;
4646 } 4631 }
4647 } 4632 }
4648 4633
4649 if (save_arg != NULL) /* number for 'whichwrap' */ 4634 if (save_arg != NULL) /* number for 'whichwrap' */
6228 } 6213 }
6229 6214
6230 /* 'switchbuf' */ 6215 /* 'switchbuf' */
6231 else if (varp == &p_swb) 6216 else if (varp == &p_swb)
6232 { 6217 {
6233 if (check_opt_strings(p_swb, p_swb_values, TRUE) != OK) 6218 if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE) != OK)
6234 errmsg = e_invarg; 6219 errmsg = e_invarg;
6235 } 6220 }
6236 6221
6237 /* 'debug' */ 6222 /* 'debug' */
6238 else if (varp == &p_debug) 6223 else if (varp == &p_debug)
7181 STRCAT(IObuff, "s"); 7166 STRCAT(IObuff, "s");
7182 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0); 7167 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0);
7183 } 7168 }
7184 /* remove 's' from p_shm */ 7169 /* remove 's' from p_shm */
7185 else if (!p_terse && p != NULL) 7170 else if (!p_terse && p != NULL)
7186 mch_memmove(p, p + 1, STRLEN(p)); 7171 STRMOVE(p, p + 1);
7187 } 7172 }
7188 7173
7189 /* when 'paste' is set or reset also change other options */ 7174 /* when 'paste' is set or reset also change other options */
7190 else if ((int *)varp == &p_paste) 7175 else if ((int *)varp == &p_paste)
7191 { 7176 {
8175 return -2; 8160 return -2;
8176 if (stringval != NULL) 8161 if (stringval != NULL)
8177 { 8162 {
8178 #ifdef FEAT_CRYPT 8163 #ifdef FEAT_CRYPT
8179 /* never return the value of the crypt key */ 8164 /* never return the value of the crypt key */
8180 if ((char_u **)varp == &curbuf->b_p_key) 8165 if ((char_u **)varp == &curbuf->b_p_key
8166 && **(char_u **)(varp) != NUL)
8181 *stringval = vim_strsave((char_u *)"*****"); 8167 *stringval = vim_strsave((char_u *)"*****");
8182 else 8168 else
8183 #endif 8169 #endif
8184 *stringval = vim_strsave(*(char_u **)(varp)); 8170 *stringval = vim_strsave(*(char_u **)(varp));
8185 } 8171 }
10030 if (var[0] == '\\' && var[1] == '\\' 10016 if (var[0] == '\\' && var[1] == '\\'
10031 && expand_option_idx >= 0 10017 && expand_option_idx >= 0
10032 && (options[expand_option_idx].flags & P_EXPAND) 10018 && (options[expand_option_idx].flags & P_EXPAND)
10033 && vim_isfilec(var[2]) 10019 && vim_isfilec(var[2])
10034 && (var[2] != '\\' || (var == buf && var[4] != '\\'))) 10020 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
10035 mch_memmove(var, var + 1, STRLEN(var)); 10021 STRMOVE(var, var + 1);
10036 #endif 10022 #endif
10037 10023
10038 *file[0] = buf; 10024 *file[0] = buf;
10039 *num_file = 1; 10025 *num_file = 1;
10040 return OK; 10026 return OK;