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