From 529c0b214df151ab6618be03ec7a2b4fa425ce4d Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Oct 04 2007 12:26:07 +0000 Subject: - patchlevel 123 --- diff --git a/7.1.123 b/7.1.123 new file mode 100644 index 0000000..6b3ee04 --- /dev/null +++ b/7.1.123 @@ -0,0 +1,259 @@ +To: vim-dev@vim.org +Subject: patch 7.1.123 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.1.123 +Problem: Win32: ":edit foo ~ foo" expands "~". +Solution: Change the call to expand_env(). +Files: src/ex_docmd.c, src/misc1.c, src/proto/misc1.pro, src/option.c + + +*** ../vim-7.1.122/src/ex_docmd.c Sun Aug 19 22:42:27 2007 +--- src/ex_docmd.c Wed Sep 26 20:29:36 2007 +*************** +*** 4403,4409 **** + || vim_strchr(eap->arg, '~') != NULL) + { + expand_env_esc(eap->arg, NameBuff, MAXPATHL, +! TRUE, NULL); + has_wildcards = mch_has_wildcard(NameBuff); + p = NameBuff; + } +--- 4402,4408 ---- + || vim_strchr(eap->arg, '~') != NULL) + { + expand_env_esc(eap->arg, NameBuff, MAXPATHL, +! TRUE, TRUE, NULL); + has_wildcards = mch_has_wildcard(NameBuff); + p = NameBuff; + } +*** ../vim-7.1.122/src/misc1.c Tue Aug 14 22:15:53 2007 +--- src/misc1.c Tue Sep 25 17:30:01 2007 +*************** +*** 3506,3514 **** + #endif + + /* + * Expand environment variable with path name. + * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded. +! * Skips over "\ ", "\~" and "\$". + * If anything fails no expansion is done and dst equals src. + */ + void +--- 3506,3543 ---- + #endif + + /* ++ * Call expand_env() and store the result in an allocated string. ++ * This is not very memory efficient, this expects the result to be freed ++ * again soon. ++ */ ++ char_u * ++ expand_env_save(src) ++ char_u *src; ++ { ++ return expand_env_save_opt(src, FALSE); ++ } ++ ++ /* ++ * Idem, but when "one" is TRUE handle the string as one file name, only ++ * expand "~" at the start. ++ */ ++ char_u * ++ expand_env_save_opt(src, one) ++ char_u *src; ++ int one; ++ { ++ char_u *p; ++ ++ p = alloc(MAXPATHL); ++ if (p != NULL) ++ expand_env_esc(src, p, MAXPATHL, FALSE, one, NULL); ++ return p; ++ } ++ ++ /* + * Expand environment variable with path name. + * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded. +! * Skips over "\ ", "\~" and "\$" (not for Win32 though). + * If anything fails no expansion is done and dst equals src. + */ + void +*************** +*** 3517,3531 **** + char_u *dst; /* where to put the result */ + int dstlen; /* maximum length of the result */ + { +! expand_env_esc(src, dst, dstlen, FALSE, NULL); + } + + void +! expand_env_esc(srcp, dst, dstlen, esc, startstr) + char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ + char_u *dst; /* where to put the result */ + int dstlen; /* maximum length of the result */ + int esc; /* escape spaces in expanded variables */ + char_u *startstr; /* start again after this (can be NULL) */ + { + char_u *src; +--- 3546,3561 ---- + char_u *dst; /* where to put the result */ + int dstlen; /* maximum length of the result */ + { +! expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL); + } + + void +! expand_env_esc(srcp, dst, dstlen, esc, one, startstr) + char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ + char_u *dst; /* where to put the result */ + int dstlen; /* maximum length of the result */ + int esc; /* escape spaces in expanded variables */ ++ int one; /* "srcp" is one file name */ + char_u *startstr; /* start again after this (can be NULL) */ + { + char_u *src; +*************** +*** 3766,3771 **** +--- 3796,3803 ---- + { + /* + * Recognize the start of a new name, for '~'. ++ * Don't do this when "one" is TRUE, to avoid expanding "~" in ++ * ":edit foo ~ foo". + */ + at_start = FALSE; + if (src[0] == '\\' && src[1] != NUL) +*************** +*** 3773,3779 **** + *dst++ = *src++; + --dstlen; + } +! else if (src[0] == ' ' || src[0] == ',') + at_start = TRUE; + *dst++ = *src++; + --dstlen; +--- 3805,3811 ---- + *dst++ = *src++; + --dstlen; + } +! else if ((src[0] == ' ' || src[0] == ',') && !one) + at_start = TRUE; + *dst++ = *src++; + --dstlen; +*************** +*** 4070,4092 **** + } + + /* +- * Call expand_env() and store the result in an allocated string. +- * This is not very memory efficient, this expects the result to be freed +- * again soon. +- */ +- char_u * +- expand_env_save(src) +- char_u *src; +- { +- char_u *p; +- +- p = alloc(MAXPATHL); +- if (p != NULL) +- expand_env(src, p, MAXPATHL); +- return p; +- } +- +- /* + * Our portable version of setenv. + */ + void +--- 4102,4107 ---- +*************** +*** 9139,9145 **** + */ + if (vim_strpbrk(p, (char_u *)"$~") != NULL) + { +! p = expand_env_save(p); + if (p == NULL) + p = pat[i]; + #ifdef UNIX +--- 9154,9160 ---- + */ + if (vim_strpbrk(p, (char_u *)"$~") != NULL) + { +! p = expand_env_save_opt(p, TRUE); + if (p == NULL) + p = pat[i]; + #ifdef UNIX +*** ../vim-7.1.122/src/proto/misc1.pro Sat May 5 20:15:33 2007 +--- src/proto/misc1.pro Tue Sep 25 17:22:36 2007 +*************** +*** 48,57 **** + void vim_beep __ARGS((void)); + void init_homedir __ARGS((void)); + void free_homedir __ARGS((void)); + void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); +! void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr)); + char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); +- char_u *expand_env_save __ARGS((char_u *src)); + void vim_setenv __ARGS((char_u *name, char_u *val)); + char_u *get_env_name __ARGS((expand_T *xp, int idx)); + void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one)); +--- 48,58 ---- + void vim_beep __ARGS((void)); + void init_homedir __ARGS((void)); + void free_homedir __ARGS((void)); ++ char_u *expand_env_save __ARGS((char_u *src)); ++ char_u *expand_env_save_opt __ARGS((char_u *src, int one)); + void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); +! void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr)); + char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); + void vim_setenv __ARGS((char_u *name, char_u *val)); + char_u *get_env_name __ARGS((expand_T *xp, int idx)); + void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one)); +*** ../vim-7.1.122/src/option.c Tue Sep 25 14:50:19 2007 +--- src/option.c Tue Sep 25 17:20:05 2007 +*************** +*** 4996,5002 **** + * For 'spellsuggest' expand after "file:". + */ + expand_env_esc(val, NameBuff, MAXPATHL, +! (char_u **)options[opt_idx].var == &p_tags, + #ifdef FEAT_SPELL + (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : + #endif +--- 4996,5002 ---- + * For 'spellsuggest' expand after "file:". + */ + expand_env_esc(val, NameBuff, MAXPATHL, +! (char_u **)options[opt_idx].var == &p_tags, FALSE, + #ifdef FEAT_SPELL + (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : + #endif +*** ../vim-7.1.122/src/version.c Tue Sep 25 22:13:14 2007 +--- src/version.c Wed Sep 26 22:30:59 2007 +*************** +*** 668,669 **** +--- 668,671 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 123, + /**/ + +-- +So when I saw the post to comp.editors, I rushed over to the FTP site to +grab it. So I yank apart the tarball, light x candles, where x= the +vim version multiplied by the md5sum of the source divided by the MAC of +my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights, +wave a dead chicken over the hard drive, and summon the power of GNU GCC +with the magic words "make config ; make!". + [Jason Spence, compiling Vim 5.0] + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ download, build and distribute -- http://www.A-A-P.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///