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