summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.350
blob: 1c4a5a34a2c3c74fb0eee0cb309b86b580ce5797 (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
To: vim_dev@googlegroups.com
Subject: Patch 7.4.350
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.350
Problem:    Using C indenting for Javascript does not work well for a {} block
	    inside parenthesis.
Solution:   When looking for a matching paren ignore one that is before the
	    start of a {} block.
Files:	    src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok


*** ../vim-7.4.349/src/misc1.c	2014-07-02 17:02:29.722212319 +0200
--- src/misc1.c	2014-07-02 18:09:39.670274070 +0200
***************
*** 6614,6620 ****
  }
  
  /*
!  * Find the matching '(', failing if it is in a comment.
   * Return NULL if no match found.
   */
      static pos_T *
--- 6614,6620 ----
  }
  
  /*
!  * Find the matching '(', ignoring it if it is in a comment.
   * Return NULL if no match found.
   */
      static pos_T *
***************
*** 6645,6650 ****
--- 6645,6676 ----
  }
  
  /*
+  * Find the matching '(', ignoring it if it is in a comment or before an
+  * unmatched {.
+  * Return NULL if no match found.
+  */
+     static pos_T *
+ find_match_paren_after_brace(ind_maxparen)	    /* XXX */
+     int		ind_maxparen;
+ {
+     pos_T	*trypos = find_match_paren(ind_maxparen);
+ 
+     if (trypos != NULL)
+     {
+ 	pos_T	*tryposBrace = find_start_brace();
+ 
+ 	/* If both an unmatched '(' and '{' is found.  Ignore the '('
+ 	 * position if the '{' is further down. */
+ 	if (tryposBrace != NULL
+ 		&& (trypos->lnum != tryposBrace->lnum
+ 		    ? trypos->lnum < tryposBrace->lnum
+ 		    : trypos->col < tryposBrace->col))
+ 	    trypos = NULL;
+     }
+     return trypos;
+ }
+ 
+ /*
   * Return ind_maxparen corrected for the difference in line number between the
   * cursor position and "startpos".  This makes sure that searching for a
   * matching paren above the cursor line doesn't find a match because of
***************
*** 7419,7425 ****
  		{
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
  		    curwin->w_cursor.col = col;
! 		    if (find_match_paren(curbuf->b_ind_maxparen) != NULL)
  			amount += curbuf->b_ind_unclosed2;
  		    else
  		    {
--- 7445,7452 ----
  		{
  		    curwin->w_cursor.lnum = our_paren_pos.lnum;
  		    curwin->w_cursor.col = col;
! 		    if (find_match_paren_after_brace(curbuf->b_ind_maxparen)
! 								      != NULL)
  			amount += curbuf->b_ind_unclosed2;
  		    else
  		    {
*** ../vim-7.4.349/src/testdir/test3.in	2013-03-07 12:39:35.000000000 +0100
--- src/testdir/test3.in	2014-07-02 18:08:06.430272641 +0200
***************
*** 1950,1955 ****
--- 1950,1959 ----
  JSSTART
  (function($){
  
+ if (cond &&
+ cond) {
+ stmt;
+ }
  var class_name='myclass';
  
  function private_method() {
*** ../vim-7.4.349/src/testdir/test3.ok	2013-03-07 12:40:03.000000000 +0100
--- src/testdir/test3.ok	2014-07-02 18:09:14.470273684 +0200
***************
*** 1728,1733 ****
--- 1728,1737 ----
  JSSTART
  (function($){
  
+ 	if (cond &&
+ 			cond) {
+ 		stmt;
+ 	}
  	var class_name='myclass';
  
  	function private_method() {
*** ../vim-7.4.349/src/version.c	2014-07-02 17:16:51.334225522 +0200
--- src/version.c	2014-07-02 18:06:31.330271184 +0200
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     350,
  /**/

-- 
FATHER:    You killed eight wedding guests in all!
LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
FATHER:    I can understand that.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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