summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.276
blob: ab4f310dc7cd9f22ce8ec0b8bd1f1a25fb1f1aea (plain) (blame)
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
299
300
301
302
To: vim_dev@googlegroups.com
Subject: Patch 7.4.276
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.276
Problem:    The fish shell is not supported.
Solution:   Use begin/end instead of () for fish. (Andy Russell)
Files:	    src/ex_cmds.c, src/misc1.c, src/option.c, src/proto/misc1.pro


*** ../vim-7.4.275/src/ex_cmds.c	2014-05-07 14:38:41.129091709 +0200
--- src/ex_cmds.c	2014-05-07 15:09:57.797108136 +0200
***************
*** 1551,1558 ****
  {
      char_u	*buf;
      long_u	len;
  
!     len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
      if (itmp != NULL)
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
      if (otmp != NULL)
--- 1551,1566 ----
  {
      char_u	*buf;
      long_u	len;
+     int		is_fish_shell;
  
! #if (defined(UNIX) && !defined(ARCHIE)) || defined(OS2)
!     /* Account for fish's different syntax for subshells */
!     is_fish_shell = (fnamecmp(get_isolated_shell_name(), "fish") == 0);
!     if (is_fish_shell)
! 	len = (long_u)STRLEN(cmd) + 13;		/* "begin; " + "; end" + NUL */
!     else
! #endif
! 	len = (long_u)STRLEN(cmd) + 3;			/* "()" + NUL */
      if (itmp != NULL)
  	len += (long_u)STRLEN(itmp) + 9;		/* " { < " + " } " */
      if (otmp != NULL)
***************
*** 1567,1573 ****
       * redirecting input and/or output.
       */
      if (itmp != NULL || otmp != NULL)
! 	vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
      else
  	STRCPY(buf, cmd);
      if (itmp != NULL)
--- 1575,1586 ----
       * redirecting input and/or output.
       */
      if (itmp != NULL || otmp != NULL)
!     {
! 	if (is_fish_shell)
! 	    vim_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd);
! 	else
! 	    vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
!     }
      else
  	STRCPY(buf, cmd);
      if (itmp != NULL)
***************
*** 1577,1583 ****
      }
  #else
      /*
!      * for shells that don't understand braces around commands, at least allow
       * the use of commands in a pipe.
       */
      STRCPY(buf, cmd);
--- 1590,1596 ----
      }
  #else
      /*
!      * For shells that don't understand braces around commands, at least allow
       * the use of commands in a pipe.
       */
      STRCPY(buf, cmd);
***************
*** 4315,4321 ****
      pos_T	old_cursor = curwin->w_cursor;
      int		start_nsubs;
  #ifdef FEAT_EVAL
!     int         save_ma = 0;
  #endif
  
      cmd = eap->arg;
--- 4328,4334 ----
      pos_T	old_cursor = curwin->w_cursor;
      int		start_nsubs;
  #ifdef FEAT_EVAL
!     int		save_ma = 0;
  #endif
  
      cmd = eap->arg;
***************
*** 5986,5992 ****
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
  			       "\\[count]", "\\[quotex]", "\\[range]",
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
!                                "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
      int flags;
  
--- 5999,6005 ----
  			       "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
  			       "\\[count]", "\\[quotex]", "\\[range]",
  			       "\\[pattern]", "\\\\bar", "/\\\\%\\$",
! 			       "s/\\\\\\~", "s/\\\\U", "s/\\\\L",
  			       "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
      int flags;
  
***************
*** 6026,6032 ****
  	  /* Replace:
  	   * "[:...:]" with "\[:...:]"
  	   * "[++...]" with "\[++...]"
! 	   * "\{" with "\\{"               -- matching "} \}"
  	   */
  	    if ((arg[0] == '[' && (arg[1] == ':'
  			 || (arg[1] == '+' && arg[2] == '+')))
--- 6039,6045 ----
  	  /* Replace:
  	   * "[:...:]" with "\[:...:]"
  	   * "[++...]" with "\[++...]"
! 	   * "\{" with "\\{"		   -- matching "} \}"
  	   */
  	    if ((arg[0] == '[' && (arg[1] == ':'
  			 || (arg[1] == '+' && arg[2] == '+')))
*** ../vim-7.4.275/src/misc1.c	2014-04-05 19:44:36.903160723 +0200
--- src/misc1.c	2014-05-07 15:04:25.921105231 +0200
***************
*** 1405,1411 ****
  #ifdef FEAT_SMARTINDENT
  	if (did_si)
  	{
! 	    int        sw = (int)get_sw_value(curbuf);
  
  	    if (p_sr)
  		newindent -= newindent % sw;
--- 1405,1411 ----
  #ifdef FEAT_SMARTINDENT
  	if (did_si)
  	{
! 	    int sw = (int)get_sw_value(curbuf);
  
  	    if (p_sr)
  		newindent -= newindent % sw;
***************
*** 10896,10898 ****
--- 10896,10936 ----
  {
      return (p_im && stuff_empty() && typebuf_typed());
  }
+ 
+ /*
+  * Returns the isolated name of the shell:
+  * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
+  * - Remove any argument.  E.g., "csh -f" -> "csh".
+  * But don't allow a space in the path, so that this works:
+  *   "/usr/bin/csh --rcfile ~/.cshrc"
+  * But don't do that for Windows, it's common to have a space in the path.
+  */
+     char_u *
+ get_isolated_shell_name()
+ {
+     char_u *p;
+ 
+ #ifdef WIN3264
+     p = gettail(p_sh);
+     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
+ #else
+     p = skiptowhite(p_sh);
+     if (*p == NUL)
+     {
+ 	/* No white space, use the tail. */
+ 	p = vim_strsave(gettail(p_sh));
+     }
+     else
+     {
+ 	char_u  *p1, *p2;
+ 
+ 	/* Find the last path separator before the space. */
+ 	p1 = p_sh;
+ 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
+ 	    if (vim_ispathsep(*p2))
+ 		p1 = p2 + 1;
+ 	p = vim_strnsave(p1, (int)(p - p1));
+     }
+ #endif
+     return p;
+ }
*** ../vim-7.4.275/src/option.c	2014-03-23 15:12:29.931264336 +0100
--- src/option.c	2014-05-07 15:05:14.117105653 +0200
***************
*** 3804,3840 ****
      else
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
  #endif
! 
!     /*
!      * Isolate the name of the shell:
!      * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
!      * - Remove any argument.  E.g., "csh -f" -> "csh".
!      * But don't allow a space in the path, so that this works:
!      *   "/usr/bin/csh --rcfile ~/.cshrc"
!      * But don't do that for Windows, it's common to have a space in the path.
!      */
! #ifdef WIN3264
!     p = gettail(p_sh);
!     p = vim_strnsave(p, (int)(skiptowhite(p) - p));
! #else
!     p = skiptowhite(p_sh);
!     if (*p == NUL)
!     {
! 	/* No white space, use the tail. */
! 	p = vim_strsave(gettail(p_sh));
!     }
!     else
!     {
! 	char_u  *p1, *p2;
! 
! 	/* Find the last path separator before the space. */
! 	p1 = p_sh;
! 	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
! 	    if (vim_ispathsep(*p2))
! 		p1 = p2 + 1;
! 	p = vim_strnsave(p1, (int)(p - p1));
!     }
! #endif
      if (p != NULL)
      {
  	/*
--- 3804,3810 ----
      else
  	do_sp = !(options[idx_sp].flags & P_WAS_SET);
  #endif
!     p = get_isolated_shell_name();
      if (p != NULL)
      {
  	/*
***************
*** 3875,3880 ****
--- 3845,3851 ----
  		    || fnamecmp(p, "zsh") == 0
  		    || fnamecmp(p, "zsh-beta") == 0
  		    || fnamecmp(p, "bash") == 0
+ 		    || fnamecmp(p, "fish") == 0
  #  ifdef WIN3264
  		    || fnamecmp(p, "cmd") == 0
  		    || fnamecmp(p, "sh.exe") == 0
***************
*** 8858,8865 ****
   * opt_type). Uses
   *
   * Returned flags:
!  *       0 hidden or unknown option, also option that does not have requested 
!  *         type (see SREQ_* in vim.h)
   *  see SOPT_* in vim.h for other flags
   *
   * Possible opt_type values: see SREQ_* in vim.h
--- 8829,8836 ----
   * opt_type). Uses
   *
   * Returned flags:
!  *       0 hidden or unknown option, also option that does not have requested
!  *	   type (see SREQ_* in vim.h)
   *  see SOPT_* in vim.h for other flags
   *
   * Possible opt_type values: see SREQ_* in vim.h
*** ../vim-7.4.275/src/proto/misc1.pro	2014-04-05 19:44:36.903160723 +0200
--- src/proto/misc1.pro	2014-05-07 14:57:04.605101368 +0200
***************
*** 103,106 ****
--- 103,107 ----
  char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len));
  void FreeWild __ARGS((int count, char_u **files));
  int goto_im __ARGS((void));
+ char_u *get_isolated_shell_name __ARGS((void));
  /* vim: set ft=c : */
*** ../vim-7.4.275/src/version.c	2014-05-07 14:38:41.129091709 +0200
--- src/version.c	2014-05-07 14:58:59.769102376 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     276,
  /**/

-- 
Support your right to bare arms!  Wear short sleeves!

 /// 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    ///