Karsten Hopp 70209d
To: vim-dev@vim.org
Karsten Hopp 70209d
Subject: Patch 7.2.355
Karsten Hopp 70209d
Fcc: outbox
Karsten Hopp 70209d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 70209d
Mime-Version: 1.0
Karsten Hopp 70209d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 70209d
Content-Transfer-Encoding: 8bit
Karsten Hopp 70209d
------------
Karsten Hopp 70209d
Karsten Hopp 70209d
Patch 7.2.355
Karsten Hopp 70209d
Problem:    Computing the cursor column in validate_cursor_col() is wrong when
Karsten Hopp 70209d
	    line numbers are used and 'n' is not in 'cpoptions', causing the
Karsten Hopp 70209d
	    popup menu to be positioned wrong.
Karsten Hopp 70209d
Solution:   Correctly use the offset. (partly by Dominique Pelle)
Karsten Hopp 70209d
Files:	    src/move.c
Karsten Hopp 70209d
Karsten Hopp 70209d
Karsten Hopp 70209d
*** ../vim-7.2.354/src/move.c	2009-11-03 16:22:59.000000000 +0100
Karsten Hopp 70209d
--- src/move.c	2010-02-03 17:15:16.000000000 +0100
Karsten Hopp 70209d
***************
Karsten Hopp 70209d
*** 889,894 ****
Karsten Hopp 70209d
--- 889,895 ----
Karsten Hopp 70209d
  {
Karsten Hopp 70209d
      colnr_T off;
Karsten Hopp 70209d
      colnr_T col;
Karsten Hopp 70209d
+     int     width;
Karsten Hopp 70209d
  
Karsten Hopp 70209d
      validate_virtcol();
Karsten Hopp 70209d
      if (!(curwin->w_valid & VALID_WCOL))
Karsten Hopp 70209d
***************
Karsten Hopp 70209d
*** 896,910 ****
Karsten Hopp 70209d
  	col = curwin->w_virtcol;
Karsten Hopp 70209d
  	off = curwin_col_off();
Karsten Hopp 70209d
  	col += off;
Karsten Hopp 70209d
  
Karsten Hopp 70209d
  	/* long line wrapping, adjust curwin->w_wrow */
Karsten Hopp 70209d
  	if (curwin->w_p_wrap
Karsten Hopp 70209d
  		&& col >= (colnr_T)W_WIDTH(curwin)
Karsten Hopp 70209d
! 		&& W_WIDTH(curwin) - off + curwin_col_off2() > 0)
Karsten Hopp 70209d
! 	{
Karsten Hopp 70209d
! 	    col -= W_WIDTH(curwin);
Karsten Hopp 70209d
! 	    col = col % (W_WIDTH(curwin) - off + curwin_col_off2());
Karsten Hopp 70209d
! 	}
Karsten Hopp 70209d
  	if (col > (int)curwin->w_leftcol)
Karsten Hopp 70209d
  	    col -= curwin->w_leftcol;
Karsten Hopp 70209d
  	else
Karsten Hopp 70209d
--- 897,910 ----
Karsten Hopp 70209d
  	col = curwin->w_virtcol;
Karsten Hopp 70209d
  	off = curwin_col_off();
Karsten Hopp 70209d
  	col += off;
Karsten Hopp 70209d
+ 	width = W_WIDTH(curwin) - off + curwin_col_off2();
Karsten Hopp 70209d
  
Karsten Hopp 70209d
  	/* long line wrapping, adjust curwin->w_wrow */
Karsten Hopp 70209d
  	if (curwin->w_p_wrap
Karsten Hopp 70209d
  		&& col >= (colnr_T)W_WIDTH(curwin)
Karsten Hopp 70209d
! 		&& width > 0)
Karsten Hopp 70209d
! 	    /* use same formula as what is used in curs_columns() */
Karsten Hopp 70209d
! 	    col -= ((col - W_WIDTH(curwin)) / width + 1) * width;
Karsten Hopp 70209d
  	if (col > (int)curwin->w_leftcol)
Karsten Hopp 70209d
  	    col -= curwin->w_leftcol;
Karsten Hopp 70209d
  	else
Karsten Hopp 70209d
***************
Karsten Hopp 70209d
*** 1041,1046 ****
Karsten Hopp 70209d
--- 1041,1047 ----
Karsten Hopp 70209d
  	/* long line wrapping, adjust curwin->w_wrow */
Karsten Hopp 70209d
  	if (curwin->w_wcol >= W_WIDTH(curwin))
Karsten Hopp 70209d
  	{
Karsten Hopp 70209d
+ 	    /* this same formula is used in validate_cursor_col() */
Karsten Hopp 70209d
  	    n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1;
Karsten Hopp 70209d
  	    curwin->w_wcol -= n * width;
Karsten Hopp 70209d
  	    curwin->w_wrow += n;
Karsten Hopp 70209d
*** ../vim-7.2.354/src/version.c	2010-02-03 15:47:59.000000000 +0100
Karsten Hopp 70209d
--- src/version.c	2010-02-03 17:40:39.000000000 +0100
Karsten Hopp 70209d
***************
Karsten Hopp 70209d
*** 683,684 ****
Karsten Hopp 70209d
--- 683,686 ----
Karsten Hopp 70209d
  {   /* Add new patch number below this line */
Karsten Hopp 70209d
+ /**/
Karsten Hopp 70209d
+     355,
Karsten Hopp 70209d
  /**/
Karsten Hopp 70209d
Karsten Hopp 70209d
-- 
Karsten Hopp 70209d
I'm in shape.  Round IS a shape.
Karsten Hopp 70209d
Karsten Hopp 70209d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 70209d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 70209d
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 70209d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///