home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.178 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  3.9 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.178
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.178
  11. Problem:    C-indent doesn't handle code right after { correctly.
  12. Solution:   Fix detecting unterminated line. (Lech Lorens)
  13. Files:      src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
  14.     
  15.  
  16. *** ../vim-7.3.177/src/misc1.c    2011-04-28 17:48:39.000000000 +0200
  17. --- src/misc1.c    2011-05-10 11:35:09.000000000 +0200
  18. ***************
  19. *** 4983,4989 ****
  20.   }
  21.   
  22.   /*
  23. !  * Return TRUE if there there is no code at *s.  White space and comments are
  24.    * not considered code.
  25.    */
  26.       static int
  27. --- 4983,4989 ----
  28.   }
  29.   
  30.   /*
  31. !  * Return TRUE if there is no code at *s.  White space and comments are
  32.    * not considered code.
  33.    */
  34.       static int
  35. ***************
  36. *** 5458,5465 ****
  37.   }
  38.   
  39.   /*
  40. !  * Recognize a line that starts with '{' or '}', or ends with ';', '{' or '}'.
  41.    * Don't consider "} else" a terminated line.
  42.    * Return the character terminating the line (ending char's have precedence if
  43.    * both apply in order to determine initializations).
  44.    */
  45. --- 5458,5468 ----
  46.   }
  47.   
  48.   /*
  49. !  * Recognize a line that starts with '{' or '}', or ends with ';', ',', '{' or
  50. !  * '}'.
  51.    * Don't consider "} else" a terminated line.
  52. +  * Don't consider a line where there are unmatched opening braces before '}',
  53. +  * ';' or ',' a terminated line.
  54.    * Return the character terminating the line (ending char's have precedence if
  55.    * both apply in order to determine initializations).
  56.    */
  57. ***************
  58. *** 5470,5475 ****
  59. --- 5473,5479 ----
  60.       int        incl_comma;    /* recognize a trailing comma */
  61.   {
  62.       char_u found_start = 0;
  63. +     unsigned n_open = 0;
  64.   
  65.       s = cin_skipcomment(s);
  66.   
  67. ***************
  68. *** 5480,5489 ****
  69.       {
  70.       /* skip over comments, "" strings and 'c'haracters */
  71.       s = skip_string(cin_skipcomment(s));
  72. !     if ((*s == ';' || (incl_open && *s == '{') || *s == '}'
  73. !                          || (incl_comma && *s == ','))
  74.           && cin_nocode(s + 1))
  75.           return *s;
  76.   
  77.       if (*s)
  78.           s++;
  79. --- 5484,5502 ----
  80.       {
  81.       /* skip over comments, "" strings and 'c'haracters */
  82.       s = skip_string(cin_skipcomment(s));
  83. !     if (*s == '}' && n_open > 0)
  84. !         --n_open;
  85. !     if (n_open == 0
  86. !         && (*s == ';' || *s == '}' || (incl_comma && *s == ','))
  87.           && cin_nocode(s + 1))
  88.           return *s;
  89. +     else if (*s == '{')
  90. +     {
  91. +         if (incl_open && cin_nocode(s + 1))
  92. +         return *s;
  93. +         else
  94. +         ++n_open;
  95. +     }
  96.   
  97.       if (*s)
  98.           s++;
  99. *** ../vim-7.3.177/src/testdir/test3.in    2011-04-28 13:01:59.000000000 +0200
  100. --- src/testdir/test3.in    2011-05-10 11:34:13.000000000 +0200
  101. ***************
  102. *** 1344,1349 ****
  103. --- 1344,1365 ----
  104.   }
  105.   
  106.   STARTTEST
  107. + :set cino&
  108. + 2kdd=][
  109. + ENDTEST
  110. + void func(void)
  111. + {
  112. +     if(x==y)
  113. +         if(y==z)
  114. +             foo=1;
  115. +         else { bar=1;
  116. +             baz=2;
  117. +         }
  118. +     printf("Foo!\n");
  119. + }
  120. + STARTTEST
  121.   :g/^STARTTEST/.,/^ENDTEST/d
  122.   :1;/start of AUTO/,$wq! test.out
  123.   ENDTEST
  124. *** ../vim-7.3.177/src/testdir/test3.ok    2011-04-28 13:01:59.000000000 +0200
  125. --- src/testdir/test3.ok    2011-05-10 11:34:13.000000000 +0200
  126. ***************
  127. *** 1204,1206 ****
  128. --- 1204,1218 ----
  129.   {
  130.   }
  131.   
  132. + void func(void)
  133. + {
  134. +     if(x==y)
  135. +         if(y==z)
  136. +             foo=1;
  137. +         else { bar=1;
  138. +             baz=2;
  139. +         }
  140. +     printf("Foo!\n");
  141. + }
  142. *** ../vim-7.3.177/src/version.c    2011-05-05 18:31:54.000000000 +0200
  143. --- src/version.c    2011-05-10 11:37:43.000000000 +0200
  144. ***************
  145. *** 716,717 ****
  146. --- 716,719 ----
  147.   {   /* Add new patch number below this line */
  148. + /**/
  149. +     178,
  150.   /**/
  151.  
  152. -- 
  153. hundred-and-one symptoms of being an internet addict:
  154. 69. Yahoo welcomes you with your own start page
  155.  
  156.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  157. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  158. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  159.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  160.