81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.164
81c2858
Fcc: outbox
81c2858
From: Bram Moolenaar <Bram@moolenaar.net>
81c2858
Mime-Version: 1.0
81c2858
Content-Type: text/plain; charset=ISO-8859-1
81c2858
Content-Transfer-Encoding: 8bit
81c2858
------------
81c2858
81c2858
Patch 7.2.164
81c2858
Problem:    When 'showbreak' is set the size of the Visual block may be
81c2858
	    reported wrong. (Eduardo Daudt Flach)
81c2858
Solution:   Temporarily make 'sbr' empty.
81c2858
Files:	    src/normal.c, src/ops.c
81c2858
81c2858
81c2858
*** ../vim-7.2.163/src/normal.c	Sat Feb 21 20:27:00 2009
81c2858
--- src/normal.c	Wed Apr 22 18:30:20 2009
81c2858
***************
81c2858
*** 3709,3721 ****
81c2858
  #ifdef FEAT_VISUAL
81c2858
      if (VIsual_active && !char_avail())
81c2858
      {
81c2858
! 	int		i = lt(VIsual, curwin->w_cursor);
81c2858
  	long		lines;
81c2858
  	colnr_T		leftcol, rightcol;
81c2858
  	linenr_T	top, bot;
81c2858
  
81c2858
  	/* Show the size of the Visual area. */
81c2858
! 	if (i)
81c2858
  	{
81c2858
  	    top = VIsual.lnum;
81c2858
  	    bot = curwin->w_cursor.lnum;
81c2858
--- 3709,3721 ----
81c2858
  #ifdef FEAT_VISUAL
81c2858
      if (VIsual_active && !char_avail())
81c2858
      {
81c2858
! 	int		cursor_bot = lt(VIsual, curwin->w_cursor);
81c2858
  	long		lines;
81c2858
  	colnr_T		leftcol, rightcol;
81c2858
  	linenr_T	top, bot;
81c2858
  
81c2858
  	/* Show the size of the Visual area. */
81c2858
! 	if (cursor_bot)
81c2858
  	{
81c2858
  	    top = VIsual.lnum;
81c2858
  	    bot = curwin->w_cursor.lnum;
81c2858
***************
81c2858
*** 3734,3747 ****
81c2858
  
81c2858
  	if (VIsual_mode == Ctrl_V)
81c2858
  	{
81c2858
  	    getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
81c2858
  	    sprintf((char *)showcmd_buf, "%ldx%ld", lines,
81c2858
  					      (long)(rightcol - leftcol + 1));
81c2858
  	}
81c2858
  	else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)
81c2858
  	    sprintf((char *)showcmd_buf, "%ld", lines);
81c2858
  	else
81c2858
! 	    sprintf((char *)showcmd_buf, "%ld", (long)(i
81c2858
  		    ? curwin->w_cursor.col - VIsual.col
81c2858
  		    : VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e'));
81c2858
  	showcmd_buf[SHOWCMD_COLS] = NUL;	/* truncate */
81c2858
--- 3734,3756 ----
81c2858
  
81c2858
  	if (VIsual_mode == Ctrl_V)
81c2858
  	{
81c2858
+ #ifdef FEAT_LINEBREAK
81c2858
+ 	    char_u *saved_sbr = p_sbr;
81c2858
+ 
81c2858
+ 	    /* Make 'sbr' empty for a moment to get the correct size. */
81c2858
+ 	    p_sbr = empty_option;
81c2858
+ #endif
81c2858
  	    getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
81c2858
+ #ifdef FEAT_LINEBREAK
81c2858
+ 	    p_sbr = saved_sbr;
81c2858
+ #endif
81c2858
  	    sprintf((char *)showcmd_buf, "%ldx%ld", lines,
81c2858
  					      (long)(rightcol - leftcol + 1));
81c2858
  	}
81c2858
  	else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)
81c2858
  	    sprintf((char *)showcmd_buf, "%ld", lines);
81c2858
  	else
81c2858
! 	    sprintf((char *)showcmd_buf, "%ld", (long)(cursor_bot
81c2858
  		    ? curwin->w_cursor.col - VIsual.col
81c2858
  		    : VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e'));
81c2858
  	showcmd_buf[SHOWCMD_COLS] = NUL;	/* truncate */
81c2858
*** ../vim-7.2.163/src/ops.c	Wed Apr 22 17:42:53 2009
81c2858
--- src/ops.c	Wed Apr 22 18:30:07 2009
81c2858
***************
81c2858
*** 392,398 ****
81c2858
      colnr_T		ws_vcol;
81c2858
      int			i = 0, j = 0;
81c2858
      int			len;
81c2858
- 
81c2858
  #ifdef FEAT_RIGHTLEFT
81c2858
      int			old_p_ri = p_ri;
81c2858
  
81c2858
--- 392,397 ----
81c2858
***************
81c2858
*** 6284,6294 ****
81c2858
--- 6283,6302 ----
81c2858
  
81c2858
  	    if (VIsual_mode == Ctrl_V)
81c2858
  	    {
81c2858
+ #ifdef FEAT_LINEBREAK
81c2858
+ 		char_u * saved_sbr = p_sbr;
81c2858
+ 
81c2858
+ 		/* Make 'sbr' empty for a moment to get the correct size. */
81c2858
+ 		p_sbr = empty_option;
81c2858
+ #endif
81c2858
  		oparg.is_VIsual = 1;
81c2858
  		oparg.block_mode = TRUE;
81c2858
  		oparg.op_type = OP_NOP;
81c2858
  		getvcols(curwin, &min_pos, &max_pos,
81c2858
  					  &oparg.start_vcol, &oparg.end_vcol);
81c2858
+ #ifdef FEAT_LINEBREAK
81c2858
+ 		p_sbr = saved_sbr;
81c2858
+ #endif
81c2858
  		if (curwin->w_curswant == MAXCOL)
81c2858
  		    oparg.end_vcol = MAXCOL;
81c2858
  		/* Swap the start, end vcol if needed */
81c2858
*** ../vim-7.2.163/src/version.c	Wed Apr 29 12:03:35 2009
81c2858
--- src/version.c	Wed Apr 29 17:38:05 2009
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     164,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
There are 10 kinds of people: Those who understand binary and those who don't.
81c2858
81c2858
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
81c2858
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
81c2858
\\\        download, build and distribute -- http://www.A-A-P.org        ///
81c2858
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///