To: vim_dev@googlegroups.com Subject: Patch 8.1.0472 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0472 Problem: Dosinst command has a few flaws. Solution: Register DisplayIcon, DisplayVersion and Publisher for the uninstaller. (closes #3485) Don't set 'diffexpr' if internal diff is supported. Allow for using Vi compatible from the command line. Remove needless sleeps. Add comments in the generated _vimrc. (Ken Takata, closes #3525) Files: src/dosinst.c *** ../vim-8.1.0471/src/dosinst.c 2018-08-18 19:04:32.458231905 +0200 --- src/dosinst.c 2018-10-13 17:23:40.545425239 +0200 *************** *** 18,23 **** --- 18,24 ---- */ #define DOSINST #include "dosinst.h" + #include #define GVIMEXT64_PATH "GvimExt64\\gvimext.dll" #define GVIMEXT32_PATH "GvimExt32\\gvimext.dll" *************** *** 63,68 **** --- 64,70 ---- enum { compat_vi = 1, + compat_vim, compat_some_enhancements, compat_all_enhancements }; *************** *** 70,75 **** --- 72,78 ---- { "\nChoose the default way to run Vim:", "Vi compatible", + "Vim default", "with some Vim enhancements", "with syntax highlighting and other features switched on", }; *************** *** 567,573 **** sleep(1); /* wait for uninstaller to start up */ num_windows = 0; EnumWindows(window_cb, 0); - sleep(1); /* wait for windows to be counted */ if (num_windows == 0) { /* Did not find the uninstaller, ask user to press --- 570,575 ---- *************** *** 583,591 **** { printf("."); fflush(stdout); num_windows = 0; EnumWindows(window_cb, 0); - sleep(1); /* wait for windows to be counted */ } while (num_windows > 0); } printf("\nDone!\n"); --- 585,593 ---- { printf("."); fflush(stdout); + sleep(1); /* wait for the uninstaller to finish */ num_windows = 0; EnumWindows(window_cb, 0); } while (num_windows > 0); } printf("\nDone!\n"); *************** *** 1159,1170 **** --- 1161,1181 ---- switch (compat_choice) { case compat_vi: + fprintf(fd, "\" Vi compatible\n"); fprintf(fd, "set compatible\n"); break; + case compat_vim: + fprintf(fd, "\" Vim's default behavior\n"); + fprintf(fd, "if &compatible\n"); + fprintf(fd, " set nocompatible\n"); + fprintf(fd, "endif\n"); + break; case compat_some_enhancements: + fprintf(fd, "\" Vim with some enhancements\n"); fprintf(fd, "source $VIMRUNTIME/defaults.vim\n"); break; case compat_all_enhancements: + fprintf(fd, "\" Vim with all enhancements\n"); fprintf(fd, "source $VIMRUNTIME/vimrc_example.vim\n"); break; } *************** *** 1173,1187 **** --- 1184,1204 ---- case remap_no: break; case remap_win: + fprintf(fd, "\n"); + fprintf(fd, "\" Remap a few keys for Windows behavior\n"); fprintf(fd, "source $VIMRUNTIME/mswin.vim\n"); break; } switch (mouse_choice) { case mouse_xterm: + fprintf(fd, "\n"); + fprintf(fd, "\" Mouse behavior (the Unix way)\n"); fprintf(fd, "behave xterm\n"); break; case mouse_mswin: + fprintf(fd, "\n"); + fprintf(fd, "\" Mouse behavior (the Windows way)\n"); fprintf(fd, "behave mswin\n"); break; case mouse_default: *************** *** 1192,1198 **** /* Use the diff.exe that comes with the self-extracting gvim.exe. */ fclose(tfd); fprintf(fd, "\n"); ! fprintf(fd, "set diffexpr=MyDiff()\n"); fprintf(fd, "function MyDiff()\n"); fprintf(fd, " let opt = '-a --binary '\n"); fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n"); --- 1209,1219 ---- /* Use the diff.exe that comes with the self-extracting gvim.exe. */ fclose(tfd); fprintf(fd, "\n"); ! fprintf(fd, "\" Use the internal diff if available.\n"); ! fprintf(fd, "\" Otherwise use the special 'diffexpr' for Windows.\n"); ! fprintf(fd, "if &diffopt !~# 'internal'\n"); ! fprintf(fd, " set diffexpr=MyDiff()\n"); ! fprintf(fd, "endif\n"); fprintf(fd, "function MyDiff()\n"); fprintf(fd, " let opt = '-a --binary '\n"); fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n"); *************** *** 1491,1497 **** HKEY hRootKey, const char *appname, const char *display_name, ! const char *uninstall_string) { LONG lRet = reg_create_key_and_value(hRootKey, appname, "DisplayName", display_name, KEY_WOW64_64KEY); --- 1512,1521 ---- HKEY hRootKey, const char *appname, const char *display_name, ! const char *uninstall_string, ! const char *display_icon, ! const char *display_version, ! const char *publisher) { LONG lRet = reg_create_key_and_value(hRootKey, appname, "DisplayName", display_name, KEY_WOW64_64KEY); *************** *** 1499,1504 **** --- 1523,1537 ---- if (ERROR_SUCCESS == lRet) lRet = reg_create_key_and_value(hRootKey, appname, "UninstallString", uninstall_string, KEY_WOW64_64KEY); + if (ERROR_SUCCESS == lRet) + lRet = reg_create_key_and_value(hRootKey, appname, + "DisplayIcon", display_icon, KEY_WOW64_64KEY); + if (ERROR_SUCCESS == lRet) + lRet = reg_create_key_and_value(hRootKey, appname, + "DisplayVersion", display_version, KEY_WOW64_64KEY); + if (ERROR_SUCCESS == lRet) + lRet = reg_create_key_and_value(hRootKey, appname, + "Publisher", publisher, KEY_WOW64_64KEY); return lRet; } *************** *** 1519,1524 **** --- 1552,1558 ---- char vim_exe_path[BUFSIZE]; char display_name[BUFSIZE]; char uninstall_string[BUFSIZE]; + char icon_string[BUFSIZE]; int i; int loop_count = is_64bit_os() ? 2 : 1; DWORD flag; *************** *** 1583,1593 **** else sprintf(uninstall_string, "%s\\uninstall-gui.exe", installdir); lRet = register_uninstall( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT, display_name, ! uninstall_string); if (ERROR_SUCCESS != lRet) return FAIL; --- 1617,1632 ---- else sprintf(uninstall_string, "%s\\uninstall-gui.exe", installdir); + sprintf(icon_string, "%s\\gvim.exe,0", installdir); + lRet = register_uninstall( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT, display_name, ! uninstall_string, ! icon_string, ! VIM_VERSION_SHORT, ! "Bram Moolenaar et al."); if (ERROR_SUCCESS != lRet) return FAIL; *************** *** 2219,2224 **** --- 2258,2265 ---- printf(" Remap keys when creating a default _vimrc file.\n"); printf("-vimrc-behave [unix|mswin|default]\n"); printf(" Set mouse behavior when creating a default _vimrc file.\n"); + printf("-vimrc-compat [vi|vim|defaults|all]\n"); + printf(" Set Vi compatibility when creating a default _vimrc file.\n"); printf("-install-popup\n"); printf(" Install the Edit-with-Vim context menu entry\n"); printf("-install-openwith\n"); *************** *** 2296,2301 **** --- 2337,2356 ---- else if (strcmp(argv[i], "default") == 0) mouse_choice = mouse_default; } + else if (strcmp(argv[i], "-vimrc-compat") == 0) + { + if (i + 1 == argc) + break; + i++; + if (strcmp(argv[i], "vi") == 0) + compat_choice = compat_vi; + else if (strcmp(argv[i], "vim") == 0) + compat_choice = compat_vim; + else if (strcmp(argv[i], "defaults") == 0) + compat_choice = compat_some_enhancements; + else if (strcmp(argv[i], "all") == 0) + compat_choice = compat_all_enhancements; + } else if (strcmp(argv[i], "-install-popup") == 0) { init_popup_choice(); *************** *** 2546,2552 **** /* When nothing found exit quietly. If something found wait for * a little while, so that the user can read the messages. */ ! if (i) sleep(3); exit(0); } --- 2601,2607 ---- /* When nothing found exit quietly. If something found wait for * a little while, so that the user can read the messages. */ ! if (i && _isatty(1)) sleep(3); exit(0); } *** ../vim-8.1.0471/src/version.c 2018-10-12 22:15:06.597268116 +0200 --- src/version.c 2018-10-13 17:25:17.988761109 +0200 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 472, /**/ -- hundred-and-one symptoms of being an internet addict: 194. Your business cards contain your e-mail and home page address. /// 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 ///