Karsten Hopp 840d0c
To: vim-dev@vim.org
Karsten Hopp 840d0c
Subject: patch 7.1.005
Karsten Hopp 840d0c
Fcc: outbox
Karsten Hopp 840d0c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 840d0c
Mime-Version: 1.0
Karsten Hopp 840d0c
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 840d0c
Content-Transfer-Encoding: 8bit
Karsten Hopp 840d0c
------------
Karsten Hopp 840d0c
Karsten Hopp 840d0c
Patch 7.1.005
Karsten Hopp 840d0c
Problem:    "cit" used on <foo></foo> deletes <foo>.  Should not delete
Karsten Hopp 840d0c
	    anything and start insertion, like "ci'" does on "". (Michal
Karsten Hopp 840d0c
	    Bozon)
Karsten Hopp 840d0c
Solution:   Handle an empty object specifically.  Made it work consistent for
Karsten Hopp 840d0c
	    various text objects.
Karsten Hopp 840d0c
Files:	    src/search.c
Karsten Hopp 840d0c
Karsten Hopp 840d0c
Karsten Hopp 840d0c
*** ../vim-7.1.004/src/search.c	Thu May 10 20:54:46 2007
Karsten Hopp 840d0c
--- src/search.c	Mon Jun  4 12:31:04 2007
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 3600,3612 ****
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
  	oap->start = start_pos;
Karsten Hopp 840d0c
  	oap->motion_type = MCHAR;
Karsten Hopp 840d0c
  	if (sol)
Karsten Hopp 840d0c
- 	{
Karsten Hopp 840d0c
  	    incl(&curwin->w_cursor);
Karsten Hopp 840d0c
! 	    oap->inclusive = FALSE;
Karsten Hopp 840d0c
! 	}
Karsten Hopp 840d0c
! 	else
Karsten Hopp 840d0c
  	    oap->inclusive = TRUE;
Karsten Hopp 840d0c
      }
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
      return OK;
Karsten Hopp 840d0c
--- 3600,3615 ----
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
  	oap->start = start_pos;
Karsten Hopp 840d0c
  	oap->motion_type = MCHAR;
Karsten Hopp 840d0c
+ 	oap->inclusive = FALSE;
Karsten Hopp 840d0c
  	if (sol)
Karsten Hopp 840d0c
  	    incl(&curwin->w_cursor);
Karsten Hopp 840d0c
! 	else if (lt(start_pos, curwin->w_cursor))
Karsten Hopp 840d0c
! 	    /* Include the character under the cursor. */
Karsten Hopp 840d0c
  	    oap->inclusive = TRUE;
Karsten Hopp 840d0c
+ 	else
Karsten Hopp 840d0c
+ 	    /* End is before the start (no text in between <>, [], etc.): don't
Karsten Hopp 840d0c
+ 	     * operate on any text. */
Karsten Hopp 840d0c
+ 	    curwin->w_cursor = start_pos;
Karsten Hopp 840d0c
      }
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
      return OK;
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 3734,3740 ****
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
  	if (in_html_tag(FALSE))
Karsten Hopp 840d0c
  	{
Karsten Hopp 840d0c
! 	    /* cursor on start tag, move to just after it */
Karsten Hopp 840d0c
  	    while (*ml_get_cursor() != '>')
Karsten Hopp 840d0c
  		if (inc_cursor() < 0)
Karsten Hopp 840d0c
  		    break;
Karsten Hopp 840d0c
--- 3737,3743 ----
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
  	if (in_html_tag(FALSE))
Karsten Hopp 840d0c
  	{
Karsten Hopp 840d0c
! 	    /* cursor on start tag, move to its '>' */
Karsten Hopp 840d0c
  	    while (*ml_get_cursor() != '>')
Karsten Hopp 840d0c
  		if (inc_cursor() < 0)
Karsten Hopp 840d0c
  		    break;
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 3838,3844 ****
Karsten Hopp 840d0c
  	/* Exclude the start tag. */
Karsten Hopp 840d0c
  	curwin->w_cursor = start_pos;
Karsten Hopp 840d0c
  	while (inc_cursor() >= 0)
Karsten Hopp 840d0c
! 	    if (*ml_get_cursor() == '>' && lt(curwin->w_cursor, end_pos))
Karsten Hopp 840d0c
  	    {
Karsten Hopp 840d0c
  		inc_cursor();
Karsten Hopp 840d0c
  		start_pos = curwin->w_cursor;
Karsten Hopp 840d0c
--- 3841,3847 ----
Karsten Hopp 840d0c
  	/* Exclude the start tag. */
Karsten Hopp 840d0c
  	curwin->w_cursor = start_pos;
Karsten Hopp 840d0c
  	while (inc_cursor() >= 0)
Karsten Hopp 840d0c
! 	    if (*ml_get_cursor() == '>')
Karsten Hopp 840d0c
  	    {
Karsten Hopp 840d0c
  		inc_cursor();
Karsten Hopp 840d0c
  		start_pos = curwin->w_cursor;
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 3860,3866 ****
Karsten Hopp 840d0c
  #ifdef FEAT_VISUAL
Karsten Hopp 840d0c
      if (VIsual_active)
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
! 	if (*p_sel == 'e')
Karsten Hopp 840d0c
  	    ++curwin->w_cursor.col;
Karsten Hopp 840d0c
  	VIsual = start_pos;
Karsten Hopp 840d0c
  	VIsual_mode = 'v';
Karsten Hopp 840d0c
--- 3863,3873 ----
Karsten Hopp 840d0c
  #ifdef FEAT_VISUAL
Karsten Hopp 840d0c
      if (VIsual_active)
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
! 	/* If the end is before the start there is no text between tags, select
Karsten Hopp 840d0c
! 	 * the char under the cursor. */
Karsten Hopp 840d0c
! 	if (lt(end_pos, start_pos))
Karsten Hopp 840d0c
! 	    curwin->w_cursor = start_pos;
Karsten Hopp 840d0c
! 	else if (*p_sel == 'e')
Karsten Hopp 840d0c
  	    ++curwin->w_cursor.col;
Karsten Hopp 840d0c
  	VIsual = start_pos;
Karsten Hopp 840d0c
  	VIsual_mode = 'v';
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 3872,3878 ****
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
  	oap->start = start_pos;
Karsten Hopp 840d0c
  	oap->motion_type = MCHAR;
Karsten Hopp 840d0c
! 	oap->inclusive = TRUE;
Karsten Hopp 840d0c
      }
Karsten Hopp 840d0c
      retval = OK;
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
--- 3879,3893 ----
Karsten Hopp 840d0c
      {
Karsten Hopp 840d0c
  	oap->start = start_pos;
Karsten Hopp 840d0c
  	oap->motion_type = MCHAR;
Karsten Hopp 840d0c
! 	if (lt(end_pos, start_pos))
Karsten Hopp 840d0c
! 	{
Karsten Hopp 840d0c
! 	    /* End is before the start: there is no text between tags; operate
Karsten Hopp 840d0c
! 	     * on an empty area. */
Karsten Hopp 840d0c
! 	    curwin->w_cursor = start_pos;
Karsten Hopp 840d0c
! 	    oap->inclusive = FALSE;
Karsten Hopp 840d0c
! 	}
Karsten Hopp 840d0c
! 	else
Karsten Hopp 840d0c
! 	    oap->inclusive = TRUE;
Karsten Hopp 840d0c
      }
Karsten Hopp 840d0c
      retval = OK;
Karsten Hopp 840d0c
  
Karsten Hopp 840d0c
*** ../vim-7.1.004/src/version.c	Tue Jun 19 11:54:23 2007
Karsten Hopp 840d0c
--- src/version.c	Tue Jun 19 12:57:03 2007
Karsten Hopp 840d0c
***************
Karsten Hopp 840d0c
*** 668,669 ****
Karsten Hopp 840d0c
--- 668,671 ----
Karsten Hopp 840d0c
  {   /* Add new patch number below this line */
Karsten Hopp 840d0c
+ /**/
Karsten Hopp 840d0c
+     5,
Karsten Hopp 840d0c
  /**/
Karsten Hopp 840d0c
Karsten Hopp 840d0c
-- 
Karsten Hopp 840d0c
Life would be so much easier if we could just look at the source code.
Karsten Hopp 840d0c
Karsten Hopp 840d0c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 840d0c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 840d0c
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 840d0c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///