7e56942
To: vim-dev@vim.org
7e56942
Subject: Patch 7.1.243
7e56942
Fcc: outbox
7e56942
From: Bram Moolenaar <Bram@moolenaar.net>
7e56942
Mime-Version: 1.0
7e56942
Content-Type: text/plain; charset=ISO-8859-1
7e56942
Content-Transfer-Encoding: 8bit
7e56942
------------
7e56942
7e56942
Patch 7.1.243 (after 7.1.240)
7e56942
Problem:    "U" doesn't work on all text in Visual mode. (Adri Verhoef)
7e56942
Solution:   Loop over all the lines to be changed.  Add tests for this.
7e56942
Files:	    src/ops.c, src/testdir/test39.in, src/testdir/test39.ok
7e56942
7e56942
7e56942
*** ../vim-7.1.242/src/ops.c	Tue Jan 22 16:01:25 2008
7e56942
--- src/ops.c	Mon Feb  4 22:23:22 2008
7e56942
***************
7e56942
*** 2197,2203 ****
7e56942
  #ifdef FEAT_VISUAL
7e56942
      struct block_def	bd;
7e56942
  #endif
7e56942
!     int			did_change;
7e56942
  
7e56942
      if (u_save((linenr_T)(oap->start.lnum - 1),
7e56942
  				       (linenr_T)(oap->end.lnum + 1)) == FAIL)
7e56942
--- 2197,2203 ----
7e56942
  #ifdef FEAT_VISUAL
7e56942
      struct block_def	bd;
7e56942
  #endif
7e56942
!     int			did_change = FALSE;
7e56942
  
7e56942
      if (u_save((linenr_T)(oap->start.lnum - 1),
7e56942
  				       (linenr_T)(oap->end.lnum + 1)) == FAIL)
7e56942
***************
7e56942
*** 2242,2248 ****
7e56942
  	else if (!oap->inclusive)
7e56942
  	    dec(&(oap->end));
7e56942
  
7e56942
! 	did_change = swapchars(oap->op_type, &pos, oap->end.col - pos.col + 1);
7e56942
  	if (did_change)
7e56942
  	{
7e56942
  	    changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
7e56942
--- 2242,2259 ----
7e56942
  	else if (!oap->inclusive)
7e56942
  	    dec(&(oap->end));
7e56942
  
7e56942
! 	if (pos.lnum == oap->end.lnum)
7e56942
! 	    did_change = swapchars(oap->op_type, &pos,
7e56942
! 						  oap->end.col - pos.col + 1);
7e56942
! 	else
7e56942
! 	    for (;;)
7e56942
! 	    {
7e56942
! 		did_change |= swapchars(oap->op_type, &pos,
7e56942
! 				pos.lnum == oap->end.lnum ? oap->end.col + 1:
7e56942
! 					   (int)STRLEN(ml_get_pos(&pos)));
7e56942
! 		if (ltoreq(oap->end, pos) || inc(&pos) == -1)
7e56942
! 		    break;
7e56942
! 	    }
7e56942
  	if (did_change)
7e56942
  	{
7e56942
  	    changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1,
7e56942
***************
7e56942
*** 2314,2330 ****
7e56942
      for (todo = length; todo > 0; --todo)
7e56942
      {
7e56942
  # ifdef FEAT_MBYTE
7e56942
- 	int pos_col = pos->col;
7e56942
- 
7e56942
  	if (has_mbyte)
7e56942
  	    /* we're counting bytes, not characters */
7e56942
  	    todo -= (*mb_ptr2len)(ml_get_pos(pos)) - 1;
7e56942
  # endif
7e56942
  	did_change |= swapchar(op_type, pos);
7e56942
- # ifdef FEAT_MBYTE
7e56942
- 	/* Changing German sharp s to SS increases the column. */
7e56942
- 	todo += pos->col - pos_col;
7e56942
- # endif
7e56942
  	if (inc(pos) == -1)    /* at end of file */
7e56942
  	    break;
7e56942
      }
7e56942
--- 2325,2335 ----
7e56942
*** ../vim-7.1.242/src/testdir/test39.in	Sun Jun 13 18:21:09 2004
7e56942
--- src/testdir/test39.in	Wed Feb  6 13:57:37 2008
7e56942
***************
7e56942
*** 1,8 ****
7e56942
--- 1,10 ----
7e56942
  
7e56942
  Test Visual block mode commands
7e56942
+ And test "U" in Visual mode, also on German sharp S.
7e56942
  
7e56942
  STARTTEST
7e56942
  :so small.vim
7e56942
+ :so mbyte.vim
7e56942
  /^abcde
7e56942
  :" Test shift-right of a block
7e56942
  jllll?jj>wll?jlll>
7e56942
***************
7e56942
*** 14,20 ****
7e56942
  Gllll?kkklllrq
7e56942
  :" Test block-change
7e56942
  G$khhh?hhkkcmno?
7e56942
! :$-4,$wq! test.out
7e56942
  ENDTEST
7e56942
  
7e56942
  abcdefghijklm
7e56942
--- 16,37 ----
7e56942
  Gllll?kkklllrq
7e56942
  :" Test block-change
7e56942
  G$khhh?hhkkcmno?
7e56942
! :$-4,$w! test.out
7e56942
! :" gUe must uppercase a whole word, also when ß changes to SS
7e56942
! Gothe youtußeuu end?Ypk0wgUe
7e56942
! :" gUfx must uppercase until x, inclusive.
7e56942
! O- youßtußexu -?0fogUfx
7e56942
! :" VU must uppercase a whole line
7e56942
! YpkVU
7e56942
! :" same, when it's the last line in the buffer
7e56942
! YPGi111?VUddP
7e56942
! :" Uppercase two lines
7e56942
! Oblah di
7e56942
! doh dut?VkUj
7e56942
! :" Uppercase part of two lines
7e56942
! ddppi333?k0i222?fyllvjfuUk
7e56942
! :/^the/,$w >> test.out
7e56942
! :qa!
7e56942
  ENDTEST
7e56942
  
7e56942
  abcdefghijklm
7e56942
*** ../vim-7.1.242/src/testdir/test39.ok	Sun Jun 13 18:59:28 2004
7e56942
--- src/testdir/test39.ok	Tue Feb  5 22:25:38 2008
7e56942
***************
7e56942
*** 3,5 ****
7e56942
--- 3,13 ----
7e56942
  axyzqqqqef mno        ghijklm
7e56942
  axyzqqqqefgmnoklm
7e56942
  abcdqqqqijklm
7e56942
+ the YOUTUSSEUU end
7e56942
+ - yOUSSTUSSEXu -
7e56942
+ THE YOUTUSSEUU END
7e56942
+ 111THE YOUTUSSEUU END
7e56942
+ BLAH DI
7e56942
+ DOH DUT
7e56942
+ 222the yoUTUSSEUU END
7e56942
+ 333THE YOUTUßeuu end
7e56942
*** ../vim-7.1.242/src/version.c	Sat Jan 26 21:15:00 2008
7e56942
--- src/version.c	Wed Feb  6 14:41:00 2008
7e56942
***************
7e56942
*** 668,669 ****
7e56942
--- 668,671 ----
7e56942
  {   /* Add new patch number below this line */
7e56942
+ /**/
7e56942
+     243,
7e56942
  /**/
7e56942
7e56942
-- 
7e56942
It's totally unfair to suggest - as many have - that engineers are socially
7e56942
inept.  Engineers simply have different objectives when it comes to social
7e56942
interaction.
7e56942
				(Scott Adams - The Dilbert principle)
7e56942
7e56942
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
7e56942
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
7e56942
\\\        download, build and distribute -- http://www.A-A-P.org        ///
7e56942
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///