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