comparison src/option.c @ 819:23f82b5d2814 v7.0c10

updated for version 7.0c10
author vimboss
date Wed, 05 Apr 2006 20:41:53 +0000
parents 1f929f3ca806
children 57c7403f6599
comparison
equal deleted inserted replaced
818:1f929f3ca806 819:23f82b5d2814
428 #define P_NFNAME 0x200000L/* only normal file name chars allowed */ 428 #define P_NFNAME 0x200000L/* only normal file name chars allowed */
429 #define P_INSECURE 0x400000L/* option was set from a modeline */ 429 #define P_INSECURE 0x400000L/* option was set from a modeline */
430 430
431 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" 431 #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255"
432 432
433 /* 'isprint' for latin1 is also used for MS-Windows, where 0x80 is used for 433 /* 'isprint' for latin1 is also used for MS-Windows cp1252, where 0x80 is used
434 * the currency sign. This isn't really latin1 but Windows-1252, but we can't 434 * for the currency sign. */
435 * detect that. */
436 #if defined(MSDOS) || defined(MSWIN) || defined(OS2) 435 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
437 # define ISP_LATIN1 (char_u *)"@,~-255" 436 # define ISP_LATIN1 (char_u *)"@,~-255"
438 #else 437 #else
439 # define ISP_LATIN1 (char_u *)"@,161-255" 438 # define ISP_LATIN1 (char_u *)"@,161-255"
440 #endif 439 #endif
6725 && p[len + 1] != NUL) 6724 && p[len + 1] != NUL)
6726 { 6725 {
6727 s = p + len + 1; 6726 s = p + len + 1;
6728 #ifdef FEAT_MBYTE 6727 #ifdef FEAT_MBYTE
6729 c1 = mb_ptr2char_adv(&s); 6728 c1 = mb_ptr2char_adv(&s);
6729 if (mb_char2cells(c1) > 1)
6730 continue;
6730 #else 6731 #else
6731 c1 = *s++; 6732 c1 = *s++;
6732 #endif 6733 #endif
6733 if (tab[i].cp == &lcs_tab2) 6734 if (tab[i].cp == &lcs_tab2)
6734 { 6735 {
6735 if (*s == NUL) 6736 if (*s == NUL)
6736 continue; 6737 continue;
6737 #ifdef FEAT_MBYTE 6738 #ifdef FEAT_MBYTE
6738 c2 = mb_ptr2char_adv(&s); 6739 c2 = mb_ptr2char_adv(&s);
6740 if (mb_char2cells(c2) > 1)
6741 continue;
6739 #else 6742 #else
6740 c2 = *s++; 6743 c2 = *s++;
6741 #endif 6744 #endif
6742 } 6745 }
6743 if (*s == ',' || *s == NUL) 6746 if (*s == ',' || *s == NUL)
10239 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found. 10242 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
10240 * 10243 *
10241 * Reset 'compatible' and set the values for options that didn't get set yet 10244 * Reset 'compatible' and set the values for options that didn't get set yet
10242 * to the Vim defaults. 10245 * to the Vim defaults.
10243 * Don't do this if the 'compatible' option has been set or reset before. 10246 * Don't do this if the 'compatible' option has been set or reset before.
10247 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
10244 */ 10248 */
10245 void 10249 void
10246 vimrc_found() 10250 vimrc_found(fname, envname)
10251 char_u *fname;
10252 char_u *envname;
10247 { 10253 {
10248 int opt_idx; 10254 int opt_idx;
10255 int dofree;
10256 char_u *p;
10249 10257
10250 if (!option_was_set((char_u *)"cp")) 10258 if (!option_was_set((char_u *)"cp"))
10251 { 10259 {
10252 p_cp = FALSE; 10260 p_cp = FALSE;
10253 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++) 10261 for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
10254 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF))) 10262 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
10255 set_option_default(opt_idx, OPT_FREE, FALSE); 10263 set_option_default(opt_idx, OPT_FREE, FALSE);
10256 didset_options(); 10264 didset_options();
10265 }
10266
10267 if (fname != NULL)
10268 {
10269 p = vim_getenv(envname, &dofree);
10270 if (p == NULL)
10271 {
10272 /* Set $MYVIMRC to the first vimrc file found. */
10273 p = FullName_save(fname, FALSE);
10274 if (p != NULL)
10275 {
10276 vim_setenv(envname, p);
10277 vim_free(p);
10278 }
10279 }
10280 else if (dofree)
10281 vim_free(p);
10257 } 10282 }
10258 } 10283 }
10259 10284
10260 /* 10285 /*
10261 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg. 10286 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.