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.332 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  4.9 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.332
  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.332 (after 7.3.202)
  11. Problem:    Indent after "public:" is not increased in C++ code. (Lech Lorens)
  12. Solution:   Check for namespace after the regular checks. (partly by Martin
  13.         Gieseking)
  14. Files:        src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
  15.  
  16.  
  17. *** ../vim-7.3.331/src/misc1.c    2011-09-07 19:58:04.000000000 +0200
  18. --- src/misc1.c    2011-10-04 17:59:52.000000000 +0200
  19. ***************
  20. *** 6389,6394 ****
  21. --- 6389,6395 ----
  22.       int        lookfor_cpp_namespace = FALSE;
  23.       int        cont_amount = 0;    /* amount for continuation line */
  24.       int        original_line_islabel;
  25. +     int        added_to_amount = 0;
  26.   
  27.       for (options = curbuf->b_p_cino; *options; )
  28.       {
  29. ***************
  30. *** 7216,7267 ****
  31.               else
  32.                   amount += ind_continuation;
  33.               }
  34. !             else if (lookfor_cpp_namespace)
  35.               {
  36. !             if (curwin->w_cursor.lnum == ourscope)
  37. !                 continue;
  38.   
  39. !             if (curwin->w_cursor.lnum == 0
  40. !                 || curwin->w_cursor.lnum
  41.                             < ourscope - FIND_NAMESPACE_LIM)
  42. !                 break;
  43.   
  44. !             l = ml_get_curline();
  45.   
  46. !             /*
  47. !              * If we're in a comment now, skip to the start of the
  48. !              * comment.
  49. !              */
  50. !             trypos = find_start_comment(ind_maxcomment);
  51. !             if (trypos != NULL)
  52. !             {
  53. !                 curwin->w_cursor.lnum = trypos->lnum + 1;
  54. !                 curwin->w_cursor.col = 0;
  55. !                 continue;
  56. !             }
  57. !             /*
  58. !              * Skip preprocessor directives and blank lines.
  59. !              */
  60. !             if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
  61. !                 continue;
  62.   
  63. !             if (cin_is_cpp_namespace(l))
  64. !             {
  65. !                 amount += ind_cpp_namespace;
  66. !                 break;
  67. !             }
  68.   
  69. !             if (cin_nocode(l))
  70. !                 continue;
  71.   
  72. !             }
  73. !             else if (lookfor != LOOKFOR_TERM
  74. !                       && lookfor != LOOKFOR_CPP_BASECLASS)
  75. !             {
  76. !             amount = scope_amount;
  77. !             if (theline[0] == '{')
  78. !                 amount += ind_open_extra;
  79.               }
  80.               break;
  81.           }
  82. --- 7217,7275 ----
  83.               else
  84.                   amount += ind_continuation;
  85.               }
  86. !             else
  87.               {
  88. !             if (lookfor != LOOKFOR_TERM
  89. !                       && lookfor != LOOKFOR_CPP_BASECLASS)
  90. !             {
  91. !                 amount = scope_amount;
  92. !                 if (theline[0] == '{')
  93. !                 {
  94. !                 amount += ind_open_extra;
  95. !                 added_to_amount = ind_open_extra;
  96. !                 }
  97. !             }
  98.   
  99. !             if (lookfor_cpp_namespace)
  100. !             {
  101. !                 /*
  102. !                  * Looking for C++ namespace, need to look further
  103. !                  * back.
  104. !                  */
  105. !                 if (curwin->w_cursor.lnum == ourscope)
  106. !                 continue;
  107. !                 if (curwin->w_cursor.lnum == 0
  108. !                     || curwin->w_cursor.lnum
  109.                             < ourscope - FIND_NAMESPACE_LIM)
  110. !                 break;
  111.   
  112. !                 l = ml_get_curline();
  113.   
  114. !                 /* If we're in a comment now, skip to the start of
  115. !                  * the comment. */
  116. !                 trypos = find_start_comment(ind_maxcomment);
  117. !                 if (trypos != NULL)
  118. !                 {
  119. !                 curwin->w_cursor.lnum = trypos->lnum + 1;
  120. !                 curwin->w_cursor.col = 0;
  121. !                 continue;
  122. !                 }
  123.   
  124. !                 /* Skip preprocessor directives and blank lines. */
  125. !                 if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum))
  126. !                 continue;
  127.   
  128. !                 /* Finally the actual check for "namespace". */
  129. !                 if (cin_is_cpp_namespace(l))
  130. !                 {
  131. !                 amount += ind_cpp_namespace - added_to_amount;
  132. !                 break;
  133. !                 }
  134.   
  135. !                 if (cin_nocode(l))
  136. !                 continue;
  137. !             }
  138.               }
  139.               break;
  140.           }
  141. *** ../vim-7.3.331/src/testdir/test3.in    2011-07-20 15:09:38.000000000 +0200
  142. --- src/testdir/test3.in    2011-10-04 17:45:20.000000000 +0200
  143. ***************
  144. *** 1309,1314 ****
  145. --- 1309,1328 ----
  146.   };
  147.   
  148.   STARTTEST
  149. + :set cino=(0,gs,hs
  150. + 2kdd]]=][
  151. + ENDTEST
  152. + class Foo : public Bar
  153. + {
  154. + public:
  155. + virtual void method1(void) = 0;
  156. + virtual void method2(int arg1,
  157. + int arg2,
  158. + int arg3) = 0;
  159. + };
  160. + STARTTEST
  161.   :set cino=+20
  162.   2kdd]]=][
  163.   ENDTEST
  164. *** ../vim-7.3.331/src/testdir/test3.ok    2011-07-20 15:09:38.000000000 +0200
  165. --- src/testdir/test3.ok    2011-10-04 17:47:25.000000000 +0200
  166. ***************
  167. *** 1190,1195 ****
  168. --- 1190,1205 ----
  169.   };
  170.   
  171.   
  172. + class Foo : public Bar
  173. + {
  174. +     public:
  175. +         virtual void method1(void) = 0;
  176. +         virtual void method2(int arg1,
  177. +                              int arg2,
  178. +                              int arg3) = 0;
  179. + };
  180.       void
  181.   foo()
  182.   {
  183. *** ../vim-7.3.331/src/version.c    2011-10-04 17:00:13.000000000 +0200
  184. --- src/version.c    2011-10-04 18:02:17.000000000 +0200
  185. ***************
  186. *** 711,712 ****
  187. --- 711,714 ----
  188.   {   /* Add new patch number below this line */
  189. + /**/
  190. +     332,
  191.   /**/
  192.  
  193. -- 
  194. Latest survey shows that 3 out of 4 people make up 75% of the
  195. world's population.
  196.  
  197.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  198. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  199. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  200.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  201.