Karsten Hopp 6b3fc8
To: vim_dev@googlegroups.com
Karsten Hopp 6b3fc8
Subject: Patch 7.3.251
Karsten Hopp 6b3fc8
Fcc: outbox
Karsten Hopp 6b3fc8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6b3fc8
Mime-Version: 1.0
Karsten Hopp 6b3fc8
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6b3fc8
Content-Transfer-Encoding: 8bit
Karsten Hopp 6b3fc8
------------
Karsten Hopp 6b3fc8
Karsten Hopp 6b3fc8
Patch 7.3.251
Karsten Hopp 6b3fc8
Problem:    "gH" deletes the current line, except when it's the last
Karsten Hopp 6b3fc8
	    line.
Karsten Hopp 6b3fc8
Solution:   Set the "include" flag to indicate the last line is to be deleted.
Karsten Hopp 6b3fc8
Files:	    src/normal.c, src/ops.c
Karsten Hopp 6b3fc8
Karsten Hopp 6b3fc8
Karsten Hopp 6b3fc8
*** ../vim-7.3.250/src/normal.c	2011-07-07 15:08:53.000000000 +0200
Karsten Hopp 6b3fc8
--- src/normal.c	2011-07-15 16:53:12.000000000 +0200
Karsten Hopp 6b3fc8
***************
Karsten Hopp 6b3fc8
*** 1795,1811 ****
Karsten Hopp 6b3fc8
  		{
Karsten Hopp 6b3fc8
  		    oap->inclusive = FALSE;
Karsten Hopp 6b3fc8
  		    /* Try to include the newline, unless it's an operator
Karsten Hopp 6b3fc8
! 		     * that works on lines only */
Karsten Hopp 6b3fc8
! 		    if (*p_sel != 'o'
Karsten Hopp 6b3fc8
! 			    && !op_on_lines(oap->op_type)
Karsten Hopp 6b3fc8
! 			    && oap->end.lnum < curbuf->b_ml.ml_line_count)
Karsten Hopp 6b3fc8
  		    {
Karsten Hopp 6b3fc8
! 			++oap->end.lnum;
Karsten Hopp 6b3fc8
! 			oap->end.col = 0;
Karsten Hopp 6b3fc8
  # ifdef FEAT_VIRTUALEDIT
Karsten Hopp 6b3fc8
! 			oap->end.coladd = 0;
Karsten Hopp 6b3fc8
  # endif
Karsten Hopp 6b3fc8
! 			++oap->line_count;
Karsten Hopp 6b3fc8
  		    }
Karsten Hopp 6b3fc8
  		}
Karsten Hopp 6b3fc8
  	    }
Karsten Hopp 6b3fc8
--- 1795,1819 ----
Karsten Hopp 6b3fc8
  		{
Karsten Hopp 6b3fc8
  		    oap->inclusive = FALSE;
Karsten Hopp 6b3fc8
  		    /* Try to include the newline, unless it's an operator
Karsten Hopp 6b3fc8
! 		     * that works on lines only. */
Karsten Hopp 6b3fc8
! 		    if (*p_sel != 'o' && !op_on_lines(oap->op_type))
Karsten Hopp 6b3fc8
  		    {
Karsten Hopp 6b3fc8
! 			if (oap->end.lnum < curbuf->b_ml.ml_line_count)
Karsten Hopp 6b3fc8
! 			{
Karsten Hopp 6b3fc8
! 			    ++oap->end.lnum;
Karsten Hopp 6b3fc8
! 			    oap->end.col = 0;
Karsten Hopp 6b3fc8
  # ifdef FEAT_VIRTUALEDIT
Karsten Hopp 6b3fc8
! 			    oap->end.coladd = 0;
Karsten Hopp 6b3fc8
  # endif
Karsten Hopp 6b3fc8
! 			    ++oap->line_count;
Karsten Hopp 6b3fc8
! 			}
Karsten Hopp 6b3fc8
! 			else
Karsten Hopp 6b3fc8
! 			{
Karsten Hopp 6b3fc8
! 			    /* Cannot move below the last line, make the op
Karsten Hopp 6b3fc8
! 			     * inclusive to tell the operation to include the
Karsten Hopp 6b3fc8
! 			     * line break. */
Karsten Hopp 6b3fc8
! 			    oap->inclusive = TRUE;
Karsten Hopp 6b3fc8
! 			}
Karsten Hopp 6b3fc8
  		    }
Karsten Hopp 6b3fc8
  		}
Karsten Hopp 6b3fc8
  	    }
Karsten Hopp 6b3fc8
*** ../vim-7.3.250/src/ops.c	2011-06-19 01:14:22.000000000 +0200
Karsten Hopp 6b3fc8
--- src/ops.c	2011-07-15 17:28:28.000000000 +0200
Karsten Hopp 6b3fc8
***************
Karsten Hopp 6b3fc8
*** 1650,1656 ****
Karsten Hopp 6b3fc8
  	    && oap->line_count > 1
Karsten Hopp 6b3fc8
  	    && oap->op_type == OP_DELETE)
Karsten Hopp 6b3fc8
      {
Karsten Hopp 6b3fc8
! 	ptr = ml_get(oap->end.lnum) + oap->end.col + oap->inclusive;
Karsten Hopp 6b3fc8
  	ptr = skipwhite(ptr);
Karsten Hopp 6b3fc8
  	if (*ptr == NUL && inindent(0))
Karsten Hopp 6b3fc8
  	    oap->motion_type = MLINE;
Karsten Hopp 6b3fc8
--- 1650,1658 ----
Karsten Hopp 6b3fc8
  	    && oap->line_count > 1
Karsten Hopp 6b3fc8
  	    && oap->op_type == OP_DELETE)
Karsten Hopp 6b3fc8
      {
Karsten Hopp 6b3fc8
! 	ptr = ml_get(oap->end.lnum) + oap->end.col;
Karsten Hopp 6b3fc8
! 	if (*ptr != NUL)
Karsten Hopp 6b3fc8
! 	    ptr += oap->inclusive;
Karsten Hopp 6b3fc8
  	ptr = skipwhite(ptr);
Karsten Hopp 6b3fc8
  	if (*ptr == NUL && inindent(0))
Karsten Hopp 6b3fc8
  	    oap->motion_type = MLINE;
Karsten Hopp 6b3fc8
***************
Karsten Hopp 6b3fc8
*** 1920,1930 ****
Karsten Hopp 6b3fc8
  		    curwin->w_cursor.coladd = 0;
Karsten Hopp 6b3fc8
  	    }
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
! 	    (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
Karsten Hopp 6b3fc8
  #ifdef FEAT_VISUAL
Karsten Hopp 6b3fc8
  				    && !oap->is_VIsual
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
  							);
Karsten Hopp 6b3fc8
  	}
Karsten Hopp 6b3fc8
  	else				/* delete characters between lines */
Karsten Hopp 6b3fc8
  	{
Karsten Hopp 6b3fc8
--- 1922,1941 ----
Karsten Hopp 6b3fc8
  		    curwin->w_cursor.coladd = 0;
Karsten Hopp 6b3fc8
  	    }
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
! 	    if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
Karsten Hopp 6b3fc8
! 		    && n > (int)STRLEN(ml_get(oap->end.lnum)))
Karsten Hopp 6b3fc8
! 	    {
Karsten Hopp 6b3fc8
! 		/* Special case: gH deletes the last line. */
Karsten Hopp 6b3fc8
! 		del_lines(1L, FALSE);
Karsten Hopp 6b3fc8
! 	    }
Karsten Hopp 6b3fc8
! 	    else
Karsten Hopp 6b3fc8
! 	    {
Karsten Hopp 6b3fc8
! 		(void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
Karsten Hopp 6b3fc8
  #ifdef FEAT_VISUAL
Karsten Hopp 6b3fc8
  				    && !oap->is_VIsual
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
  							);
Karsten Hopp 6b3fc8
+ 	    }
Karsten Hopp 6b3fc8
  	}
Karsten Hopp 6b3fc8
  	else				/* delete characters between lines */
Karsten Hopp 6b3fc8
  	{
Karsten Hopp 6b3fc8
***************
Karsten Hopp 6b3fc8
*** 1941,1957 ****
Karsten Hopp 6b3fc8
  	    ++curwin->w_cursor.lnum;
Karsten Hopp 6b3fc8
  	    del_lines((long)(oap->line_count - 2), FALSE);
Karsten Hopp 6b3fc8
  
Karsten Hopp 6b3fc8
! 	    /* delete from start of line until op_end */
Karsten Hopp 6b3fc8
! 	    curwin->w_cursor.col = 0;
Karsten Hopp 6b3fc8
! 	    (void)del_bytes((long)(oap->end.col + 1 - !oap->inclusive),
Karsten Hopp 6b3fc8
! 					!virtual_op, oap->op_type == OP_DELETE
Karsten Hopp 6b3fc8
  #ifdef FEAT_VISUAL
Karsten Hopp 6b3fc8
  					&& !oap->is_VIsual
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
  							    );
Karsten Hopp 6b3fc8
! 	    curwin->w_cursor = curpos;		/* restore curwin->w_cursor */
Karsten Hopp 6b3fc8
! 
Karsten Hopp 6b3fc8
! 	    (void)do_join(2, FALSE, FALSE);
Karsten Hopp 6b3fc8
  	}
Karsten Hopp 6b3fc8
      }
Karsten Hopp 6b3fc8
  
Karsten Hopp 6b3fc8
--- 1952,1980 ----
Karsten Hopp 6b3fc8
  	    ++curwin->w_cursor.lnum;
Karsten Hopp 6b3fc8
  	    del_lines((long)(oap->line_count - 2), FALSE);
Karsten Hopp 6b3fc8
  
Karsten Hopp 6b3fc8
! 	    n = (oap->end.col + 1 - !oap->inclusive);
Karsten Hopp 6b3fc8
! 	    if (oap->inclusive && oap->end.lnum == curbuf->b_ml.ml_line_count
Karsten Hopp 6b3fc8
! 		    && n > (int)STRLEN(ml_get(oap->end.lnum)))
Karsten Hopp 6b3fc8
! 	    {
Karsten Hopp 6b3fc8
! 		/* Special case: gH deletes the last line. */
Karsten Hopp 6b3fc8
! 		del_lines(1L, FALSE);
Karsten Hopp 6b3fc8
! 		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
Karsten Hopp 6b3fc8
! 		if (curwin->w_cursor.lnum > 1)
Karsten Hopp 6b3fc8
! 		    --curwin->w_cursor.lnum;
Karsten Hopp 6b3fc8
! 	    }
Karsten Hopp 6b3fc8
! 	    else
Karsten Hopp 6b3fc8
! 	    {
Karsten Hopp 6b3fc8
! 		/* delete from start of line until op_end */
Karsten Hopp 6b3fc8
! 		curwin->w_cursor.col = 0;
Karsten Hopp 6b3fc8
! 		(void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE
Karsten Hopp 6b3fc8
  #ifdef FEAT_VISUAL
Karsten Hopp 6b3fc8
  					&& !oap->is_VIsual
Karsten Hopp 6b3fc8
  #endif
Karsten Hopp 6b3fc8
  							    );
Karsten Hopp 6b3fc8
! 		curwin->w_cursor = curpos;	/* restore curwin->w_cursor */
Karsten Hopp 6b3fc8
! 	    }
Karsten Hopp 6b3fc8
! 	    if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
Karsten Hopp 6b3fc8
! 		(void)do_join(2, FALSE, FALSE);
Karsten Hopp 6b3fc8
  	}
Karsten Hopp 6b3fc8
      }
Karsten Hopp 6b3fc8
  
Karsten Hopp 6b3fc8
*** ../vim-7.3.250/src/version.c	2011-07-15 15:54:39.000000000 +0200
Karsten Hopp 6b3fc8
--- src/version.c	2011-07-15 17:35:18.000000000 +0200
Karsten Hopp 6b3fc8
***************
Karsten Hopp 6b3fc8
*** 711,712 ****
Karsten Hopp 6b3fc8
--- 711,714 ----
Karsten Hopp 6b3fc8
  {   /* Add new patch number below this line */
Karsten Hopp 6b3fc8
+ /**/
Karsten Hopp 6b3fc8
+     251,
Karsten Hopp 6b3fc8
  /**/
Karsten Hopp 6b3fc8
Karsten Hopp 6b3fc8
-- 
Karsten Hopp 6b3fc8
            ### Hiroshima 45, Chernobyl 86, Windows 95 ###
Karsten Hopp 6b3fc8
Karsten Hopp 6b3fc8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6b3fc8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6b3fc8
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 6b3fc8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///