Karsten Hopp 269579
To: vim-dev@vim.org
Karsten Hopp 269579
Subject: patch 7.0.199
Karsten Hopp 269579
Fcc: outbox
Karsten Hopp 269579
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 269579
Mime-Version: 1.0
Karsten Hopp 269579
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 269579
Content-Transfer-Encoding: 8bit
Karsten Hopp 269579
------------
Karsten Hopp 269579
Karsten Hopp 269579
Patch 7.0.199
Karsten Hopp 269579
Problem:    When using multi-byte characters the combination of completion and
Karsten Hopp 269579
            formatting may result in a wrong cursor position.
Karsten Hopp 269579
Solution:   Don't decrement the cursor column, use dec_cursor(). (Yukihiro
Karsten Hopp 269579
            Nakadaira)  Also check for the column to be zero.
Karsten Hopp 269579
Files:      src/edit.c
Karsten Hopp 269579
Karsten Hopp 269579
Karsten Hopp 269579
*** ../vim-7.0.198/src/edit.c	Sun Feb  4 02:37:40 2007
Karsten Hopp 269579
--- src/edit.c	Fri Feb 16 01:15:49 2007
Karsten Hopp 269579
***************
Karsten Hopp 269579
*** 3448,3458 ****
Karsten Hopp 269579
  	    }
Karsten Hopp 269579
  	    else
Karsten Hopp 269579
  	    {
Karsten Hopp 269579
  		/* put the cursor on the last char, for 'tw' formatting */
Karsten Hopp 269579
! 		curwin->w_cursor.col--;
Karsten Hopp 269579
  		if (stop_arrow() == OK)
Karsten Hopp 269579
  		    insertchar(NUL, 0, -1);
Karsten Hopp 269579
! 		curwin->w_cursor.col++;
Karsten Hopp 269579
  	    }
Karsten Hopp 269579
  
Karsten Hopp 269579
  	    auto_format(FALSE, TRUE);
Karsten Hopp 269579
--- 3449,3464 ----
Karsten Hopp 269579
  	    }
Karsten Hopp 269579
  	    else
Karsten Hopp 269579
  	    {
Karsten Hopp 269579
+ 		int prev_col = curwin->w_cursor.col;
Karsten Hopp 269579
+ 
Karsten Hopp 269579
  		/* put the cursor on the last char, for 'tw' formatting */
Karsten Hopp 269579
! 		if (prev_col > 0)
Karsten Hopp 269579
! 		    dec_cursor();
Karsten Hopp 269579
  		if (stop_arrow() == OK)
Karsten Hopp 269579
  		    insertchar(NUL, 0, -1);
Karsten Hopp 269579
! 		if (prev_col > 0
Karsten Hopp 269579
! 			     && ml_get_curline()[curwin->w_cursor.col] != NUL)
Karsten Hopp 269579
! 		    inc_cursor();
Karsten Hopp 269579
  	    }
Karsten Hopp 269579
  
Karsten Hopp 269579
  	    auto_format(FALSE, TRUE);
Karsten Hopp 269579
*** ../vim-7.0.198/src/version.c	Tue Feb 20 03:18:20 2007
Karsten Hopp 269579
--- src/version.c	Tue Feb 20 03:32:12 2007
Karsten Hopp 269579
***************
Karsten Hopp 269579
*** 668,669 ****
Karsten Hopp 269579
--- 668,671 ----
Karsten Hopp 269579
  {   /* Add new patch number below this line */
Karsten Hopp 269579
+ /**/
Karsten Hopp 269579
+     199,
Karsten Hopp 269579
  /**/
Karsten Hopp 269579
Karsten Hopp 269579
-- 
Karsten Hopp 269579
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 269579
156. You forget your friend's name but not her e-mail address.
Karsten Hopp 269579
Karsten Hopp 269579
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 269579
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 269579
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 269579
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///