lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
361ac55
To: vim_dev@googlegroups.com
361ac55
Subject: Patch 7.3.333
361ac55
Fcc: outbox
361ac55
From: Bram Moolenaar <Bram@moolenaar.net>
361ac55
Mime-Version: 1.0
361ac55
Content-Type: text/plain; charset=UTF-8
361ac55
Content-Transfer-Encoding: 8bit
361ac55
------------
361ac55
361ac55
Patch 7.3.333
361ac55
Problem:    Using "." to repeat a Visual delete counts the size in bytes, not
361ac55
	    characters.  (Connor Lane Smith)
361ac55
Solution:   Store the virtual column numbers instead of byte positions.
361ac55
Files:	    src/normal.c
361ac55
361ac55
361ac55
*** ../vim-7.3.332/src/normal.c	2011-07-15 17:51:30.000000000 +0200
361ac55
--- src/normal.c	2011-10-04 19:47:14.000000000 +0200
361ac55
***************
361ac55
*** 20,26 ****
361ac55
   */
361ac55
  static int	resel_VIsual_mode = NUL;	/* 'v', 'V', or Ctrl-V */
361ac55
  static linenr_T	resel_VIsual_line_count;	/* number of lines */
361ac55
! static colnr_T	resel_VIsual_col;		/* nr of cols or end col */
361ac55
  
361ac55
  static int	restart_VIsual_select = 0;
361ac55
  #endif
361ac55
--- 20,26 ----
361ac55
   */
361ac55
  static int	resel_VIsual_mode = NUL;	/* 'v', 'V', or Ctrl-V */
361ac55
  static linenr_T	resel_VIsual_line_count;	/* number of lines */
361ac55
! static colnr_T	resel_VIsual_vcol;		/* nr of cols or end col */
361ac55
  
361ac55
  static int	restart_VIsual_select = 0;
361ac55
  #endif
361ac55
***************
361ac55
*** 1436,1442 ****
361ac55
      /* The visual area is remembered for redo */
361ac55
      static int	    redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
361ac55
      static linenr_T redo_VIsual_line_count; /* number of lines */
361ac55
!     static colnr_T  redo_VIsual_col;	    /* number of cols or end column */
361ac55
      static long	    redo_VIsual_count;	    /* count for Visual operator */
361ac55
  # ifdef FEAT_VIRTUALEDIT
361ac55
      int		    include_line_break = FALSE;
361ac55
--- 1436,1442 ----
361ac55
      /* The visual area is remembered for redo */
361ac55
      static int	    redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
361ac55
      static linenr_T redo_VIsual_line_count; /* number of lines */
361ac55
!     static colnr_T  redo_VIsual_vcol;	    /* number of cols or end column */
361ac55
      static long	    redo_VIsual_count;	    /* count for Visual operator */
361ac55
  # ifdef FEAT_VIRTUALEDIT
361ac55
      int		    include_line_break = FALSE;
361ac55
***************
361ac55
*** 1549,1570 ****
361ac55
  #ifdef FEAT_VISUAL
361ac55
  	if (redo_VIsual_busy)
361ac55
  	{
361ac55
  	    oap->start = curwin->w_cursor;
361ac55
  	    curwin->w_cursor.lnum += redo_VIsual_line_count - 1;
361ac55
  	    if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
361ac55
  		curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
361ac55
  	    VIsual_mode = redo_VIsual_mode;
361ac55
! 	    if (VIsual_mode == 'v')
361ac55
  	    {
361ac55
! 		if (redo_VIsual_line_count <= 1)
361ac55
! 		    curwin->w_cursor.col += redo_VIsual_col - 1;
361ac55
  		else
361ac55
! 		    curwin->w_cursor.col = redo_VIsual_col;
361ac55
! 	    }
361ac55
! 	    if (redo_VIsual_col == MAXCOL)
361ac55
! 	    {
361ac55
! 		curwin->w_curswant = MAXCOL;
361ac55
! 		coladvance((colnr_T)MAXCOL);
361ac55
  	    }
361ac55
  	    cap->count0 = redo_VIsual_count;
361ac55
  	    if (redo_VIsual_count != 0)
361ac55
--- 1549,1579 ----
361ac55
  #ifdef FEAT_VISUAL
361ac55
  	if (redo_VIsual_busy)
361ac55
  	{
361ac55
+ 	    /* Redo of an operation on a Visual area. Use the same size from
361ac55
+ 	     * redo_VIsual_line_count and redo_VIsual_vcol. */
361ac55
  	    oap->start = curwin->w_cursor;
361ac55
  	    curwin->w_cursor.lnum += redo_VIsual_line_count - 1;
361ac55
  	    if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
361ac55
  		curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
361ac55
  	    VIsual_mode = redo_VIsual_mode;
361ac55
! 	    if (redo_VIsual_vcol == MAXCOL || VIsual_mode == 'v')
361ac55
  	    {
361ac55
! 		if (VIsual_mode == 'v')
361ac55
! 		{
361ac55
! 		    if (redo_VIsual_line_count <= 1)
361ac55
! 		    {
361ac55
! 			validate_virtcol();
361ac55
! 			curwin->w_curswant =
361ac55
! 				     curwin->w_virtcol + redo_VIsual_vcol - 1;
361ac55
! 		    }
361ac55
! 		    else
361ac55
! 			curwin->w_curswant = redo_VIsual_vcol;
361ac55
! 		}
361ac55
  		else
361ac55
! 		{
361ac55
! 		    curwin->w_curswant = MAXCOL;
361ac55
! 		}
361ac55
! 		coladvance(curwin->w_curswant);
361ac55
  	    }
361ac55
  	    cap->count0 = redo_VIsual_count;
361ac55
  	    if (redo_VIsual_count != 0)
361ac55
***************
361ac55
*** 1710,1716 ****
361ac55
  		    }
361ac55
  		}
361ac55
  		else if (redo_VIsual_busy)
361ac55
! 		    oap->end_vcol = oap->start_vcol + redo_VIsual_col - 1;
361ac55
  		/*
361ac55
  		 * Correct oap->end.col and oap->start.col to be the
361ac55
  		 * upper-left and lower-right corner of the block area.
361ac55
--- 1719,1725 ----
361ac55
  		    }
361ac55
  		}
361ac55
  		else if (redo_VIsual_busy)
361ac55
! 		    oap->end_vcol = oap->start_vcol + redo_VIsual_vcol - 1;
361ac55
  		/*
361ac55
  		 * Correct oap->end.col and oap->start.col to be the
361ac55
  		 * upper-left and lower-right corner of the block area.
361ac55
***************
361ac55
*** 1735,1747 ****
361ac55
  		 */
361ac55
  		resel_VIsual_mode = VIsual_mode;
361ac55
  		if (curwin->w_curswant == MAXCOL)
361ac55
! 		    resel_VIsual_col = MAXCOL;
361ac55
! 		else if (VIsual_mode == Ctrl_V)
361ac55
! 		    resel_VIsual_col = oap->end_vcol - oap->start_vcol + 1;
361ac55
! 		else if (oap->line_count > 1)
361ac55
! 		    resel_VIsual_col = oap->end.col;
361ac55
  		else
361ac55
! 		    resel_VIsual_col = oap->end.col - oap->start.col + 1;
361ac55
  		resel_VIsual_line_count = oap->line_count;
361ac55
  	    }
361ac55
  
361ac55
--- 1744,1765 ----
361ac55
  		 */
361ac55
  		resel_VIsual_mode = VIsual_mode;
361ac55
  		if (curwin->w_curswant == MAXCOL)
361ac55
! 		    resel_VIsual_vcol = MAXCOL;
361ac55
  		else
361ac55
! 		{
361ac55
! 		    if (VIsual_mode != Ctrl_V)
361ac55
! 			getvvcol(curwin, &(oap->end),
361ac55
! 						  NULL, NULL, &oap->end_vcol);
361ac55
! 		    if (VIsual_mode == Ctrl_V || oap->line_count <= 1)
361ac55
! 		    {
361ac55
! 			if (VIsual_mode != Ctrl_V)
361ac55
! 			    getvvcol(curwin, &(oap->start),
361ac55
! 						&oap->start_vcol, NULL, NULL);
361ac55
! 			resel_VIsual_vcol = oap->end_vcol - oap->start_vcol + 1;
361ac55
! 		    }
361ac55
! 		    else
361ac55
! 			resel_VIsual_vcol = oap->end_vcol;
361ac55
! 		}
361ac55
  		resel_VIsual_line_count = oap->line_count;
361ac55
  	    }
361ac55
  
361ac55
***************
361ac55
*** 1769,1775 ****
361ac55
  		if (!redo_VIsual_busy)
361ac55
  		{
361ac55
  		    redo_VIsual_mode = resel_VIsual_mode;
361ac55
! 		    redo_VIsual_col = resel_VIsual_col;
361ac55
  		    redo_VIsual_line_count = resel_VIsual_line_count;
361ac55
  		    redo_VIsual_count = cap->count0;
361ac55
  		}
361ac55
--- 1787,1793 ----
361ac55
  		if (!redo_VIsual_busy)
361ac55
  		{
361ac55
  		    redo_VIsual_mode = resel_VIsual_mode;
361ac55
! 		    redo_VIsual_vcol = resel_VIsual_vcol;
361ac55
  		    redo_VIsual_line_count = resel_VIsual_line_count;
361ac55
  		    redo_VIsual_count = cap->count0;
361ac55
  		}
361ac55
***************
361ac55
*** 7631,7642 ****
361ac55
  	    if (VIsual_mode == 'v')
361ac55
  	    {
361ac55
  		if (resel_VIsual_line_count <= 1)
361ac55
! 		    curwin->w_cursor.col += resel_VIsual_col * cap->count0 - 1;
361ac55
  		else
361ac55
! 		    curwin->w_cursor.col = resel_VIsual_col;
361ac55
! 		check_cursor_col();
361ac55
  	    }
361ac55
! 	    if (resel_VIsual_col == MAXCOL)
361ac55
  	    {
361ac55
  		curwin->w_curswant = MAXCOL;
361ac55
  		coladvance((colnr_T)MAXCOL);
361ac55
--- 7649,7664 ----
361ac55
  	    if (VIsual_mode == 'v')
361ac55
  	    {
361ac55
  		if (resel_VIsual_line_count <= 1)
361ac55
! 		{
361ac55
! 		    validate_virtcol();
361ac55
! 		    curwin->w_curswant = curwin->w_virtcol
361ac55
! 					+ resel_VIsual_vcol * cap->count0 - 1;
361ac55
! 		}
361ac55
  		else
361ac55
! 		    curwin->w_curswant = resel_VIsual_vcol;
361ac55
! 		coladvance(curwin->w_curswant);
361ac55
  	    }
361ac55
! 	    if (resel_VIsual_vcol == MAXCOL)
361ac55
  	    {
361ac55
  		curwin->w_curswant = MAXCOL;
361ac55
  		coladvance((colnr_T)MAXCOL);
361ac55
***************
361ac55
*** 7645,7651 ****
361ac55
  	    {
361ac55
  		validate_virtcol();
361ac55
  		curwin->w_curswant = curwin->w_virtcol
361ac55
! 					 + resel_VIsual_col * cap->count0 - 1;
361ac55
  		coladvance(curwin->w_curswant);
361ac55
  	    }
361ac55
  	    else
361ac55
--- 7667,7673 ----
361ac55
  	    {
361ac55
  		validate_virtcol();
361ac55
  		curwin->w_curswant = curwin->w_virtcol
361ac55
! 					+ resel_VIsual_vcol * cap->count0 - 1;
361ac55
  		coladvance(curwin->w_curswant);
361ac55
  	    }
361ac55
  	    else
361ac55
*** ../vim-7.3.332/src/version.c	2011-10-04 18:03:43.000000000 +0200
361ac55
--- src/version.c	2011-10-04 21:05:44.000000000 +0200
361ac55
***************
361ac55
*** 711,712 ****
361ac55
--- 711,714 ----
361ac55
  {   /* Add new patch number below this line */
361ac55
+ /**/
361ac55
+     333,
361ac55
  /**/
361ac55
361ac55
-- 
361ac55
It was recently discovered that research causes cancer in rats.
361ac55
361ac55
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
361ac55
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
361ac55
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
361ac55
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///