diff options
Diffstat (limited to 'data/vim/patches/8.1.0534')
-rw-r--r-- | data/vim/patches/8.1.0534 | 379 |
1 files changed, 379 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.0534 b/data/vim/patches/8.1.0534 new file mode 100644 index 000000000..9071561d6 --- /dev/null +++ b/data/vim/patches/8.1.0534 @@ -0,0 +1,379 @@ +To: vim_dev@googlegroups.com +Subject: Patch 8.1.0534 +Fcc: outbox +From: Bram Moolenaar <Bram@moolenaar.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 8.1.0534 +Problem: MS-Windows installer uses different $HOME than Vim. +Solution: Use the Vim logic also in the MS-Windows installer. (Ken Takata, + closes #3564) +Files: src/dosinst.c, src/misc1.c + + +*** ../vim-8.1.0533/src/dosinst.c 2018-10-13 17:25:24.112718312 +0200 +--- src/dosinst.c 2018-11-16 19:39:24.551085683 +0100 +*************** +*** 115,128 **** + vimfiles_dir_vim, + vimfiles_dir_home + }; +! static char *(vimfiles_dir_choices[]) = + { + "\nCreate plugin directories:", + "No", + "In the VIM directory", + "In your HOME directory", + }; +- static int vimfiles_dir_choice; + + /* non-zero when selected to install the popup menu entry. */ + static int install_popup = 0; +--- 115,127 ---- + vimfiles_dir_vim, + vimfiles_dir_home + }; +! static char *(vimfiles_dir_choices[]) = + { + "\nCreate plugin directories:", + "No", + "In the VIM directory", + "In your HOME directory", + }; + + /* non-zero when selected to install the popup menu entry. */ + static int install_popup = 0; +*************** +*** 741,747 **** + choices[choice_count].installfunc = NULL; + choices[choice_count].active = 0; + choices[choice_count].changefunc = NULL; +! choices[choice_count].installfunc = NULL; + ++choice_count; + } + +--- 740,747 ---- + choices[choice_count].installfunc = NULL; + choices[choice_count].active = 0; + choices[choice_count].changefunc = NULL; +! choices[choice_count].text = NULL; +! choices[choice_count].arg = 0; + ++choice_count; + } + +*************** +*** 2089,2094 **** +--- 2089,2096 ---- + static void + set_directories_text(int idx) + { ++ int vimfiles_dir_choice = choices[idx].arg; ++ + if (vimfiles_dir_choice == (int)vimfiles_dir_none) + alloc_text(idx, "Do NOT create plugin directories%s", ""); + else +*************** +*** 2097,2102 **** +--- 2099,2189 ---- + } + + /* ++ * To get the "real" home directory: ++ * - get value of $HOME ++ * - if not found, get value of $HOMEDRIVE$HOMEPATH ++ * - if not found, get value of $USERPROFILE ++ * ++ * This code is based on init_homedir() in misc1.c, keep in sync! ++ */ ++ static char *homedir = NULL; ++ ++ void ++ init_homedir(void) ++ { ++ char *var; ++ char buf[MAX_PATH]; ++ ++ if (homedir != NULL) ++ { ++ free(homedir); ++ homedir = NULL; ++ } ++ ++ var = getenv("HOME"); ++ ++ /* ++ * Typically, $HOME is not defined on Windows, unless the user has ++ * specifically defined it for Vim's sake. However, on Windows NT ++ * platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for ++ * each user. Try constructing $HOME from these. ++ */ ++ if (var == NULL || *var == NUL) ++ { ++ char *homedrive, *homepath; ++ ++ homedrive = getenv("HOMEDRIVE"); ++ homepath = getenv("HOMEPATH"); ++ if (homepath == NULL || *homepath == NUL) ++ homepath = "\\"; ++ if (homedrive != NULL ++ && strlen(homedrive) + strlen(homepath) < MAX_PATH) ++ { ++ sprintf(buf, "%s%s", homedrive, homepath); ++ if (buf[0] != NUL) ++ var = buf; ++ } ++ } ++ ++ if (var == NULL) ++ var = getenv("USERPROFILE"); ++ ++ /* ++ * Weird but true: $HOME may contain an indirect reference to another ++ * variable, esp. "%USERPROFILE%". Happens when $USERPROFILE isn't set ++ * when $HOME is being set. ++ */ ++ if (var != NULL && *var == '%') ++ { ++ char *p; ++ char *exp; ++ ++ p = strchr(var + 1, '%'); ++ if (p != NULL) ++ { ++ strncpy(buf, var + 1, p - (var + 1)); ++ buf[p - (var + 1)] = NUL; ++ exp = getenv(buf); ++ if (exp != NULL && *exp != NUL ++ && strlen(exp) + strlen(p) < MAX_PATH) ++ { ++ _snprintf(buf, MAX_PATH, "%s%s", exp, p + 1); ++ buf[MAX_PATH - 1] = NUL; ++ var = buf; ++ } ++ } ++ } ++ ++ if (var != NULL && *var == NUL) // empty is same as not set ++ var = NULL; ++ ++ if (var == NULL) ++ homedir = NULL; ++ else ++ homedir = _strdup(var); ++ } ++ ++ /* + * Change the directory that the vim plugin directories will be created in: + * $HOME, $VIM or nowhere. + */ +*************** +*** 2106,2114 **** + int choice_count = TABLE_SIZE(vimfiles_dir_choices); + + /* Don't offer the $HOME choice if $HOME isn't set. */ +! if (getenv("HOME") == NULL) + --choice_count; +! vimfiles_dir_choice = get_choice(vimfiles_dir_choices, choice_count); + set_directories_text(idx); + } + +--- 2193,2201 ---- + int choice_count = TABLE_SIZE(vimfiles_dir_choices); + + /* Don't offer the $HOME choice if $HOME isn't set. */ +! if (homedir == NULL) + --choice_count; +! choices[idx].arg = get_choice(vimfiles_dir_choices, choice_count); + set_directories_text(idx); + } + +*************** +*** 2120,2125 **** +--- 2207,2213 ---- + install_vimfilesdir(int idx) + { + int i; ++ int vimfiles_dir_choice = choices[idx].arg; + char *p; + char vimdir_path[BUFSIZE]; + char vimfiles_path[BUFSIZE]; +*************** +*** 2144,2151 **** + } + case vimfiles_dir_home: + { +! /* Find the $HOME directory. Its existence was already checked. */ +! p = getenv("HOME"); + if (p == NULL) + { + printf("Internal error: $HOME is NULL\n"); +--- 2232,2239 ---- + } + case vimfiles_dir_home: + { +! // Find the $HOME directory. Its existence was already checked. +! p = homedir; + if (p == NULL) + { + printf("Internal error: $HOME is NULL\n"); +*************** +*** 2156,2162 **** + } + case vimfiles_dir_none: + { +! /* Do not create vim plugin directory */ + return; + } + } +--- 2244,2250 ---- + } + case vimfiles_dir_none: + { +! // Do not create vim plugin directory. + return; + } + } +*************** +*** 2185,2198 **** + struct stat st; + char tmp_dirname[BUFSIZE]; + char *p; + + choices[choice_count].text = alloc(150); + choices[choice_count].changefunc = change_directories_choice; + choices[choice_count].installfunc = install_vimfilesdir; + choices[choice_count].active = 1; + +! /* Check if the "compiler" directory already exists. That's a good +! * indication that the plugin directories were already created. */ + if (getenv("HOME") != NULL) + { + vimfiles_dir_choice = (int)vimfiles_dir_home; +--- 2273,2287 ---- + struct stat st; + char tmp_dirname[BUFSIZE]; + char *p; ++ int vimfiles_dir_choice; + + choices[choice_count].text = alloc(150); + choices[choice_count].changefunc = change_directories_choice; + choices[choice_count].installfunc = install_vimfilesdir; + choices[choice_count].active = 1; + +! // Check if the "compiler" directory already exists. That's a good +! // indication that the plugin directories were already created. + if (getenv("HOME") != NULL) + { + vimfiles_dir_choice = (int)vimfiles_dir_home; +*************** +*** 2204,2210 **** + { + vimfiles_dir_choice = (int)vimfiles_dir_vim; + p = getenv("VIM"); +! if (p == NULL) /* No $VIM in path, use the install dir */ + dir_remove_last(installdir, tmp_dirname); + else + strcpy(tmp_dirname, p); +--- 2293,2299 ---- + { + vimfiles_dir_choice = (int)vimfiles_dir_vim; + p = getenv("VIM"); +! if (p == NULL) // No $VIM in path, use the install dir. + dir_remove_last(installdir, tmp_dirname); + else + strcpy(tmp_dirname, p); +*************** +*** 2213,2218 **** +--- 2302,2308 ---- + vimfiles_dir_choice = (int)vimfiles_dir_none; + } + ++ choices[choice_count].arg = vimfiles_dir_choice; + set_directories_text(choice_count); + ++choice_count; + } +*************** +*** 2369,2374 **** +--- 2459,2466 ---- + } + else if (strcmp(argv[i], "-create-directories") == 0) + { ++ int vimfiles_dir_choice; ++ + init_directories_choice(); + if (argv[i + 1][0] != '-') + { +*************** +*** 2377,2384 **** + vimfiles_dir_choice = (int)vimfiles_dir_vim; + else if (strcmp(argv[i], "home") == 0) + { +! if (getenv("HOME") == NULL) /* No $HOME in environment */ +! vimfiles_dir_choice = (int)vimfiles_dir_vim; + else + vimfiles_dir_choice = (int)vimfiles_dir_home; + } +--- 2469,2476 ---- + vimfiles_dir_choice = (int)vimfiles_dir_vim; + else if (strcmp(argv[i], "home") == 0) + { +! if (homedir == NULL) // No $HOME in environment +! vimfiles_dir_choice = (int)vimfiles_dir_none; + else + vimfiles_dir_choice = (int)vimfiles_dir_home; + } +*************** +*** 2391,2396 **** +--- 2483,2489 ---- + } + else /* No choice specified, default to vim directory */ + vimfiles_dir_choice = (int)vimfiles_dir_vim; ++ choices[choice_count - 1].arg = vimfiles_dir_choice; + } + else if (strcmp(argv[i], "-register-OLE") == 0) + { +*************** +*** 2589,2594 **** +--- 2682,2688 ---- + + /* Initialize this program. */ + do_inits(argv); ++ init_homedir(); + + if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0) + { +*** ../vim-8.1.0533/src/misc1.c 2018-10-07 23:16:33.138616197 +0200 +--- src/misc1.c 2018-11-16 19:37:57.095655169 +0100 +*************** +*** 3905,3910 **** +--- 3905,3912 ---- + * - do mch_dirname() to get the real name of that directory. + * This also works with mounts and links. + * Don't do this for MS-DOS, it will change the "current dir" for a drive. ++ * For Windows: ++ * This code is duplicated in init_homedir() in dosinst.c. Keep in sync! + */ + static char_u *homedir = NULL; + +*** ../vim-8.1.0533/src/version.c 2018-11-16 18:50:13.346534543 +0100 +--- src/version.c 2018-11-16 19:33:13.893507996 +0100 +*************** +*** 794,795 **** +--- 794,797 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 534, + /**/ + +-- +Two cows are standing together in a field. One asks the other: +"So what do you think about this Mad Cow Disease?" +The other replies: "That doesn't concern me. I'm a helicopter." + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ an exciting new programming language -- http://www.Zimbu.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |