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 / old / 5.5.053 < prev    next >
Encoding:
Internet Message Format  |  1999-12-04  |  4.2 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.5.053
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.053
  8. Problem:    Indenting is wrong after a function when 'cino' has "fs".  Another
  9.         problem when 'cino' has "{s".
  10. Solution:   Put line after closing "}" of a function at the left margin.
  11.         Apply ind_open_extra in the right way after a '{'.
  12. Files:        src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok
  13.  
  14.  
  15. *** ../vim-5.5.52/src/misc1.c    Wed Sep 22 10:06:23 1999
  16. --- src/misc1.c    Thu Nov  4 10:17:00 1999
  17. ***************
  18. *** 4199,4204 ****
  19. --- 4199,4205 ----
  20.               amount += ind_open_imag;
  21.           else
  22.           {
  23. +             /* Compensate for adding ind_open_extra later. */
  24.               amount -= ind_open_extra;
  25.               if (amount < 0)
  26.               amount = 0;
  27. ***************
  28. *** 4246,4252 ****
  29. --- 4247,4257 ----
  30.               if (lookfor == LOOKFOR_UNTERM)
  31.               amount += ind_continuation;
  32.               else if (lookfor != LOOKFOR_TERM)
  33. +             {
  34.               amount = scope_amount;
  35. +             if (theline[0] == '{')
  36. +                 amount += ind_open_extra;
  37. +             }
  38.               break;
  39.           }
  40.   
  41. ***************
  42. *** 4427,4433 ****
  43.                */
  44.               if (lookfor != LOOKFOR_TERM && theline[0] == '{')
  45.               {
  46. !             amount = cur_amount + ind_open_extra;
  47.               break;
  48.               }
  49.   
  50. --- 4432,4447 ----
  51.                */
  52.               if (lookfor != LOOKFOR_TERM && theline[0] == '{')
  53.               {
  54. !             amount = cur_amount;
  55. !             /*
  56. !              * Only add ind_open_extra when the current line
  57. !              * doesn't start with a '{', which must have a match
  58. !              * in the same line (scope is the same).  Probably:
  59. !              *    { 1, 2 },
  60. !              * ->    { 3, 4 }
  61. !              */
  62. !             if (*skipwhite(l) != '{')
  63. !                 amount += ind_open_extra;
  64.               break;
  65.               }
  66.   
  67. ***************
  68. *** 4464,4469 ****
  69. --- 4478,4485 ----
  70.                * ->    here;
  71.                */
  72.               amount = cur_amount;
  73. +             if (theline[0] == '{')
  74. +                 amount += ind_open_extra;
  75.               if (lookfor != LOOKFOR_TERM)
  76.               {
  77.                   amount += ind_level + ind_no_brace;
  78. ***************
  79. *** 4655,4660 ****
  80. --- 4671,4679 ----
  81.   
  82.               if (theline[0] == '{')
  83.                   amount += ind_open_extra;
  84. +             /* See remark above: "Only add ind_open_extra.." */
  85. +             if (*skipwhite(l) == '{')
  86. +                 amount -= ind_open_extra;
  87.               lookfor = LOOKFOR_TERM;
  88.   
  89.               /*
  90. ***************
  91. *** 4740,4745 ****
  92. --- 4759,4771 ----
  93.            * not in a comment, put it the left margin.
  94.            */
  95.           if (cin_isfuncdecl(theline))
  96. +             break;
  97. +         /*
  98. +          * Finding the closing '}' of a previous function.  Put
  99. +          * current line at the left margin.  For when 'cino' has "fs".
  100. +          */
  101. +         if (*skipwhite(l) == '}')
  102.               break;
  103.   
  104.           /*
  105. *** ../vim-5.5.52/src/testdir/test3.in    Wed Sep 22 10:06:10 1999
  106. --- src/testdir/test3.in    Thu Nov  4 10:32:51 1999
  107. ***************
  108. *** 643,648 ****
  109. --- 643,686 ----
  110.   }
  111.   
  112.   STARTTEST
  113. + :set cino={s,fs
  114. + ]]=/ foo
  115. + ENDTEST
  116. + void bar(void)
  117. + {
  118. +     static array[2][2] =
  119. +     {
  120. +         { 1, 2 },
  121. +         { 3, 4 },
  122. +     }
  123. +     while (a)
  124. +     {
  125. +         foo(&a);
  126. +     }
  127. +     {
  128. +         int a;
  129. +         {
  130. +             a = a + 1;
  131. +         }
  132. +     }
  133. +     b = a;
  134. +     }
  135. + void func(void)
  136. +     {
  137. +     a = 1;
  138. +     {
  139. +         b = 2;
  140. +     }
  141. +     c = 3;
  142. +     d = 4;
  143. +     }
  144. + /* foo */
  145. + STARTTEST
  146.   :set cino=
  147.   /while
  148.   ohere
  149. *** ../vim-5.5.52/src/testdir/test3.ok    Wed Sep 22 10:06:10 1999
  150. --- src/testdir/test3.ok    Sat Dec  4 20:28:17 1999
  151. ***************
  152. *** 640,645 ****
  153. --- 640,683 ----
  154.   }
  155.   
  156.   STARTTEST
  157. + :set cino={s,fs
  158. + ]]=/ foo
  159. + ENDTEST
  160. + void bar(void)
  161. +     {
  162. +     static array[2][2] =
  163. +         {
  164. +             { 1, 2 },
  165. +             { 3, 4 },
  166. +         }
  167. +     while (a)
  168. +         {
  169. +         foo(&a);
  170. +         }
  171. +         {
  172. +         int a;
  173. +             {
  174. +             a = a + 1;
  175. +             }
  176. +         }
  177. +     b = a;
  178. +     }
  179. + void func(void)
  180. +     {
  181. +     a = 1;
  182. +         {
  183. +         b = 2;
  184. +         }
  185. +     c = 3;
  186. +     d = 4;
  187. +     }
  188. + /* foo */
  189. + STARTTEST
  190.   :set cino=
  191.   /while
  192.   ohere
  193. *** ../vim-5.5.52/src/version.c    Sat Dec  4 20:31:11 1999
  194. --- src/version.c    Sat Dec  4 20:31:33 1999
  195. ***************
  196. *** 420,420 ****
  197. --- 420,421 ----
  198.   {   /* Add new patch number below this line */
  199. +     53,
  200.  
  201. -- 
  202. "The amigos also appear to be guilty of not citing the work of others who had
  203. gone before them.  Even worse, they have a chapter about modeling time and
  204. space without making a single reference to Star Trek!"
  205.             (Scott Ambler, reviewing the UML User Guide)
  206.  
  207. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  208.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  209.