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

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.251
  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.251
  11. Problem:    "gH<Del>" deletes the current line, except when it's the last
  12.         line.
  13. Solution:   Set the "include" flag to indicate the last line is to be deleted.
  14. Files:        src/normal.c, src/ops.c
  15.  
  16.  
  17. *** ../vim-7.3.250/src/normal.c    2011-07-07 15:08:53.000000000 +0200
  18. --- src/normal.c    2011-07-15 16:53:12.000000000 +0200
  19. ***************
  20. *** 1795,1811 ****
  21.           {
  22.               oap->inclusive = FALSE;
  23.               /* Try to include the newline, unless it's an operator
  24. !              * that works on lines only */
  25. !             if (*p_sel != 'o'
  26. !                 && !op_on_lines(oap->op_type)
  27. !                 && oap->end.lnum < curbuf->b_ml.ml_line_count)
  28.               {
  29. !             ++oap->end.lnum;
  30. !             oap->end.col = 0;
  31.   # ifdef FEAT_VIRTUALEDIT
  32. !             oap->end.coladd = 0;
  33.   # endif
  34. !             ++oap->line_count;
  35.               }
  36.           }
  37.           }
  38. --- 1795,1819 ----
  39.           {
  40.               oap->inclusive = FALSE;
  41.               /* Try to include the newline, unless it's an operator
  42. !              * that works on lines only. */
  43. !             if (*p_sel != 'o' && !op_on_lines(oap->op_type))
  44.               {
  45. !             if (oap->end.lnum < curbuf->b_ml.ml_line_count)
  46. !             {
  47. !                 ++oap->end.lnum;
  48. !                 oap->end.col = 0;
  49.   # ifdef FEAT_VIRTUALEDIT
  50. !                 oap->end.coladd = 0;
  51.   # endif
  52. !                 ++oap->line_count;
  53. !             }
  54. !             else
  55. !             {
  56. !                 /* Cannot move below the last line, make the op
  57. !                  * inclusive to tell the operation to include the
  58. !                  * line break. */
  59. !                 oap->inclusive = TRUE;
  60. !             }
  61.               }
  62.           }
  63.           }
  64. *** ../vim-7.3.250/src/ops.c    2011-06-19 01:14:22.000000000 +0200
  65. --- src/ops.c    2011-07-15 17:28:28.000000000 +0200
  66. ***************
  67. *** 1650,1656 ****
  68.           && oap->line_count > 1
  69.           && oap->op_type == OP_DELETE)
  70.       {
  71. !     ptr = ml_get(oap->end.lnum) + oap->end.col + oap->inclusive;
  72.       ptr = skipwhite(ptr);
  73.       if (*ptr == NUL && inindent(0))
  74.           oap->motion_type = MLINE;
  75. --- 1650,1658 ----
  76.           && oap->line_count > 1
  77.           && oap->op_type == OP_DELETE)
  78.       {
  79. !     ptr = ml_get(oap->end.lnum) + oap->end.col;
  80. !     if (*ptr != NUL)
  81. !         ptr += oap->inclusive;
  82.       ptr = skipwhite(ptr);
  83.       if (*ptr == NUL && inindent(0))
  84.           oap->motion_type = MLINE;
  85. ***************
  86. *** 1920,1930 ****
  87.               curwin->w_cursor.coladd = 0;
  88.           }
  89.   #endif
  90. !         (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
  91.   #ifdef FEAT_VISUAL
  92.                       && !oap->is_VIsual
  93.   #endif
  94.                               );
  95.       }
  96.       else                /* delete characters between lines */
  97.       {
  98. --- 1922,1941 ----
  99.               curwin->w_cursor.coladd = 0;
  100.           }
  101.   #endif
  102. !         if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
  103. !             && n > (int)STRLEN(ml_get(oap->end.lnum)))
  104. !         {
  105. !         /* Special case: gH<Del> deletes the last line. */
  106. !         del_lines(1L, FALSE);
  107. !         }
  108. !         else
  109. !         {
  110. !         (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
  111.   #ifdef FEAT_VISUAL
  112.                       && !oap->is_VIsual
  113.   #endif
  114.                               );
  115. +         }
  116.       }
  117.       else                /* delete characters between lines */
  118.       {
  119. ***************
  120. *** 1941,1957 ****
  121.           ++curwin->w_cursor.lnum;
  122.           del_lines((long)(oap->line_count - 2), FALSE);
  123.   
  124. !         /* delete from start of line until op_end */
  125. !         curwin->w_cursor.col = 0;
  126. !         (void)del_bytes((long)(oap->end.col + 1 - !oap->inclusive),
  127. !                     !virtual_op, oap->op_type == OP_DELETE
  128.   #ifdef FEAT_VISUAL
  129.                       && !oap->is_VIsual
  130.   #endif
  131.                                   );
  132. !         curwin->w_cursor = curpos;        /* restore curwin->w_cursor */
  133. !         (void)do_join(2, FALSE, FALSE);
  134.       }
  135.       }
  136.   
  137. --- 1952,1980 ----
  138.           ++curwin->w_cursor.lnum;
  139.           del_lines((long)(oap->line_count - 2), FALSE);
  140.   
  141. !         n = (oap->end.col + 1 - !oap->inclusive);
  142. !         if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
  143. !             && n > (int)STRLEN(ml_get(oap->end.lnum)))
  144. !         {
  145. !         /* Special case: gH<Del> deletes the last line. */
  146. !         del_lines(1L, FALSE);
  147. !         curwin->w_cursor = curpos;    /* restore curwin->w_cursor */
  148. !         if (curwin->w_cursor.lnum > 1)
  149. !             --curwin->w_cursor.lnum;
  150. !         }
  151. !         else
  152. !         {
  153. !         /* delete from start of line until op_end */
  154. !         curwin->w_cursor.col = 0;
  155. !         (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
  156.   #ifdef FEAT_VISUAL
  157.                       && !oap->is_VIsual
  158.   #endif
  159.                                   );
  160. !         curwin->w_cursor = curpos;    /* restore curwin->w_cursor */
  161. !         }
  162. !         if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
  163. !         (void)do_join(2, FALSE, FALSE);
  164.       }
  165.       }
  166.   
  167. *** ../vim-7.3.250/src/version.c    2011-07-15 15:54:39.000000000 +0200
  168. --- src/version.c    2011-07-15 17:35:18.000000000 +0200
  169. ***************
  170. *** 711,712 ****
  171. --- 711,714 ----
  172.   {   /* Add new patch number below this line */
  173. + /**/
  174. +     251,
  175.   /**/
  176.  
  177. -- 
  178.             ### Hiroshima 45, Chernobyl 86, Windows 95 ###
  179.  
  180.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  181. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  182. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  183.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  184.