summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0472
blob: e3baaa7a8a99f6dd7d78cdcf05343183217168ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0472
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.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 <io.h>
  
  #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    ///