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.6.062 < prev    next >
Encoding:
Internet Message Format  |  2000-04-11  |  5.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6.062
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.6.062
  8. Problem:    The documentation says that setting 'smartindent' doesn't have an
  9.         effect when 'cindent' is set, but it does make a difference for
  10.         lines starting with "#". (Neil Bird)
  11. Solution:   Really ignore 'smartindent' when 'cindent' is set.
  12. Files:        src/misc1.c, src/ops.c
  13.  
  14.  
  15. *** ../vim-5.6.61/src/misc1.c    Sun Apr  2 13:04:17 2000
  16. --- src/misc1.c    Wed Apr 12 13:41:21 2000
  17. ***************
  18. *** 187,192 ****
  19. --- 187,197 ----
  20.       int        new_plines = 0;        /* init for GCC */
  21.       int        extra_plines = 0;
  22.   #ifdef SMARTINDENT
  23. +     int        do_si = (curbuf->b_p_si
  24. + # ifdef CINDENT
  25. +                     && !curbuf->b_p_cin
  26. + # endif
  27. +             );
  28.       int        no_si = FALSE;        /* reset did_si afterwards */
  29.       int        first_char = NUL;    /* init for GCC */
  30.   #endif
  31. ***************
  32. *** 238,244 ****
  33.       {
  34.       p_extra = saved_line + curwin->w_cursor.col;
  35.   #ifdef SMARTINDENT
  36. !     if (curbuf->b_p_si)        /* need first char after new line break */
  37.       {
  38.           p = skipwhite(p_extra);
  39.           first_char = *p;
  40. --- 243,249 ----
  41.       {
  42.       p_extra = saved_line + curwin->w_cursor.col;
  43.   #ifdef SMARTINDENT
  44. !     if (do_si)        /* need first char after new line break */
  45.       {
  46.           p = skipwhite(p_extra);
  47.           first_char = *p;
  48. ***************
  49. *** 271,277 ****
  50.        */
  51.       if (curbuf->b_p_ai
  52.   #ifdef SMARTINDENT
  53. !             || curbuf->b_p_si
  54.   #endif
  55.                           )
  56.       {
  57. --- 276,282 ----
  58.        */
  59.       if (curbuf->b_p_ai
  60.   #ifdef SMARTINDENT
  61. !             || do_si
  62.   #endif
  63.                           )
  64.       {
  65. ***************
  66. *** 290,296 ****
  67.        * don't add an indent. Fixes inserting a NL before '{' in line
  68.        *    "if (condition) {"
  69.        */
  70. !     if (!trunc_line && curbuf->b_p_si && *saved_line != NUL
  71.                       && (p_extra == NULL || first_char != '{'))
  72.       {
  73.           char_u  *ptr;
  74. --- 295,301 ----
  75.        * don't add an indent. Fixes inserting a NL before '{' in line
  76.        *    "if (condition) {"
  77.        */
  78. !     if (!trunc_line && do_si && *saved_line != NUL
  79.                       && (p_extra == NULL || first_char != '{'))
  80.       {
  81.           char_u  *ptr;
  82. ***************
  83. *** 445,451 ****
  84.           }
  85.           curwin->w_cursor = old_cursor;
  86.       }
  87. !     if (curbuf->b_p_si)
  88.           can_si = TRUE;
  89.   #endif /* SMARTINDENT */
  90.   
  91. --- 450,456 ----
  92.           }
  93.           curwin->w_cursor = old_cursor;
  94.       }
  95. !     if (do_si)
  96.           can_si = TRUE;
  97.   #endif /* SMARTINDENT */
  98.   
  99. ***************
  100. *** 692,698 ****
  101.               /* Recompute the indent, it may have changed. */
  102.               if (curbuf->b_p_ai
  103.   #ifdef SMARTINDENT
  104. !                     || curbuf->b_p_si
  105.   #endif
  106.                                  )
  107.               newindent = get_indent_str(leader);
  108. --- 697,703 ----
  109.               /* Recompute the indent, it may have changed. */
  110.               if (curbuf->b_p_ai
  111.   #ifdef SMARTINDENT
  112. !                     || do_si
  113.   #endif
  114.                                  )
  115.               newindent = get_indent_str(leader);
  116. ***************
  117. *** 764,770 ****
  118.           if (comment_end[0] == '*' && comment_end[1] == '/' &&
  119.               (curbuf->b_p_ai
  120.   #ifdef SMARTINDENT
  121. !                     || curbuf->b_p_si
  122.   #endif
  123.                                  ))
  124.           {
  125. --- 769,775 ----
  126.           if (comment_end[0] == '*' && comment_end[1] == '/' &&
  127.               (curbuf->b_p_ai
  128.   #ifdef SMARTINDENT
  129. !                     || do_si
  130.   #endif
  131.                                  ))
  132.           {
  133. *** ../vim-5.6.61/src/ops.c    Sun Apr  2 11:57:11 2000
  134. --- src/ops.c    Wed Apr 12 15:18:58 2000
  135. ***************
  136. *** 214,227 ****
  137.           shift_block(oap, amount);
  138.   #endif
  139.       else
  140. !         /* Don't move the line right if it starts with # and p_si is set. */
  141.   #if defined(SMARTINDENT) || defined(CINDENT)
  142.           if (first_char != '#' || (
  143.   # ifdef SMARTINDENT
  144.                !curbuf->b_p_si
  145. ! # endif
  146. ! # if defined(SMARTINDENT) && defined(CINDENT)
  147. !                 &&
  148.   # endif
  149.   # ifdef CINDENT
  150.                (!curbuf->b_p_cin || !in_cinkeys('#', ' ', TRUE))
  151. --- 214,229 ----
  152.           shift_block(oap, amount);
  153.   #endif
  154.       else
  155. !         /* Move the line right if it doesn't start with '#', 'smartindent'
  156. !          * isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */
  157.   #if defined(SMARTINDENT) || defined(CINDENT)
  158.           if (first_char != '#' || (
  159.   # ifdef SMARTINDENT
  160. + #  ifdef CINDENT
  161. +              (!curbuf->b_p_si || curbuf->b_p_cin) &&
  162. + #  else
  163.                !curbuf->b_p_si
  164. ! #  endif
  165.   # endif
  166.   # ifdef CINDENT
  167.                (!curbuf->b_p_cin || !in_cinkeys('#', ' ', TRUE))
  168. ***************
  169. *** 1955,1961 ****
  170.       {
  171.       l = 0;
  172.   #ifdef SMARTINDENT
  173. !     if (curbuf->b_p_si)
  174.           can_si = TRUE;    /* It's like opening a new line, do si */
  175.   #endif
  176.       }
  177. --- 1958,1968 ----
  178.       {
  179.       l = 0;
  180.   #ifdef SMARTINDENT
  181. !     if (curbuf->b_p_si
  182. ! # ifdef CINDENT
  183. !         && !curbuf->b_p_cin
  184. ! # endif
  185. !         )
  186.           can_si = TRUE;    /* It's like opening a new line, do si */
  187.   #endif
  188.       }
  189. ***************
  190. *** 2786,2799 ****
  191.               if (count == 0 && i == y_size - 1)
  192.                   lendiff = STRLEN(ptr);
  193.   #if defined(SMARTINDENT) || defined(CINDENT)
  194. !             if (*ptr == '#'
  195.   # ifdef SMARTINDENT
  196. !                && curbuf->b_p_si
  197.   # endif
  198.   # ifdef CINDENT
  199. !                && curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE)
  200.   # endif
  201. !                         )
  202.                   indent = 0;     /* Leave # lines at start */
  203.               else
  204.   #endif
  205. --- 2793,2810 ----
  206.               if (count == 0 && i == y_size - 1)
  207.                   lendiff = STRLEN(ptr);
  208.   #if defined(SMARTINDENT) || defined(CINDENT)
  209. !             if (*ptr == '#' && (
  210.   # ifdef SMARTINDENT
  211. ! #  ifdef CINDENT
  212. !                (curbuf->b_p_si && !curbuf->b_p_cin) ||
  213. ! #  else
  214. !                curbuf->b_p_si
  215. ! #  endif
  216.   # endif
  217.   # ifdef CINDENT
  218. !                (curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE))
  219.   # endif
  220. !                         ))
  221.                   indent = 0;     /* Leave # lines at start */
  222.               else
  223.   #endif
  224. *** ../vim-5.6.61/src/version.c    Fri Apr  7 10:12:54 2000
  225. --- src/version.c    Wed Apr 12 18:43:17 2000
  226. ***************
  227. *** 420,421 ****
  228. --- 420,423 ----
  229.   {   /* Add new patch number below this line */
  230. + /**/
  231. +     62,
  232.   /**/
  233.  
  234. -- 
  235. The Feynman problem solving Algorithm:
  236.     1) Write down the problem
  237.     2) Think real hard
  238.     3) Write down the answer
  239.  
  240. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\
  241. \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
  242.