Karsten Hopp 88ac88
To: vim_dev@googlegroups.com
Karsten Hopp 88ac88
Subject: Patch 7.3.713
Karsten Hopp 88ac88
Fcc: outbox
Karsten Hopp 88ac88
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 88ac88
Mime-Version: 1.0
Karsten Hopp 88ac88
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 88ac88
Content-Transfer-Encoding: 8bit
Karsten Hopp 88ac88
------------
Karsten Hopp 88ac88
Karsten Hopp 88ac88
Patch 7.3.713
Karsten Hopp 88ac88
Problem:    printf() can only align to bytes, not characters.
Karsten Hopp 88ac88
Solution:   Add the "S" item. (Christian Brabandt)
Karsten Hopp 88ac88
Files:	    runtime/doc/eval.txt, src/message.c
Karsten Hopp 88ac88
Karsten Hopp 88ac88
Karsten Hopp 88ac88
*** ../vim-7.3.712/runtime/doc/eval.txt	2012-10-21 00:44:59.000000000 +0200
Karsten Hopp 88ac88
--- runtime/doc/eval.txt	2012-11-14 18:00:40.000000000 +0100
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 4427,4432 ****
Karsten Hopp 88ac88
--- 4451,4457 ----
Karsten Hopp 88ac88
  
Karsten Hopp 88ac88
  		Often used items are:
Karsten Hopp 88ac88
  		  %s	string
Karsten Hopp 88ac88
+ 		  %6S	string right-aligned in 6 display cells
Karsten Hopp 88ac88
  		  %6s	string right-aligned in 6 bytes
Karsten Hopp 88ac88
  		  %.9s	string truncated to 9 bytes
Karsten Hopp 88ac88
  		  %c	single byte
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 4541,4546 ****
Karsten Hopp 88ac88
--- 4566,4575 ----
Karsten Hopp 88ac88
  		s	The text of the String argument is used.  If a
Karsten Hopp 88ac88
  			precision is specified, no more bytes than the number
Karsten Hopp 88ac88
  			specified are used.
Karsten Hopp 88ac88
+ 		S	The text of the String argument is used.  If a
Karsten Hopp 88ac88
+ 			precision is specified, no more display cells than the
Karsten Hopp 88ac88
+ 			number specified are used.  Without the |+multi_byte|
Karsten Hopp 88ac88
+ 			feature works just like 's'.
Karsten Hopp 88ac88
  
Karsten Hopp 88ac88
  							*printf-f* *E807*
Karsten Hopp 88ac88
  		f	The Float argument is converted into a string of the 
Karsten Hopp 88ac88
*** ../vim-7.3.712/src/message.c	2012-03-28 16:49:25.000000000 +0200
Karsten Hopp 88ac88
--- src/message.c	2012-11-14 17:58:25.000000000 +0100
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 4290,4295 ****
Karsten Hopp 88ac88
--- 4290,4296 ----
Karsten Hopp 88ac88
  	    case '%':
Karsten Hopp 88ac88
  	    case 'c':
Karsten Hopp 88ac88
  	    case 's':
Karsten Hopp 88ac88
+ 	    case 'S':
Karsten Hopp 88ac88
  		length_modifier = '\0';
Karsten Hopp 88ac88
  		str_arg_l = 1;
Karsten Hopp 88ac88
  		switch (fmt_spec)
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 4318,4323 ****
Karsten Hopp 88ac88
--- 4319,4325 ----
Karsten Hopp 88ac88
  		    }
Karsten Hopp 88ac88
  
Karsten Hopp 88ac88
  		case 's':
Karsten Hopp 88ac88
+ 		case 'S':
Karsten Hopp 88ac88
  		    str_arg =
Karsten Hopp 88ac88
  #ifndef HAVE_STDARG_H
Karsten Hopp 88ac88
  				(char *)get_a_arg(arg_idx);
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 4354,4359 ****
Karsten Hopp 88ac88
--- 4356,4379 ----
Karsten Hopp 88ac88
  			str_arg_l = (q == NULL) ? precision
Karsten Hopp 88ac88
  						      : (size_t)(q - str_arg);
Karsten Hopp 88ac88
  		    }
Karsten Hopp 88ac88
+ #ifdef FEAT_MBYTE
Karsten Hopp 88ac88
+ 		    if (fmt_spec == 'S')
Karsten Hopp 88ac88
+ 		    {
Karsten Hopp 88ac88
+ 			if (min_field_width != 0)
Karsten Hopp 88ac88
+ 			    min_field_width += STRLEN(str_arg)
Karsten Hopp 88ac88
+ 				     - mb_string2cells((char_u *)str_arg, -1);
Karsten Hopp 88ac88
+ 			if (precision)
Karsten Hopp 88ac88
+ 			{
Karsten Hopp 88ac88
+ 			    char_u *p1 = (char_u *)str_arg;
Karsten Hopp 88ac88
+ 			    size_t i;
Karsten Hopp 88ac88
+ 
Karsten Hopp 88ac88
+ 			    for (i = 0; i < precision && *p1; i++)
Karsten Hopp 88ac88
+ 				p1 += mb_ptr2len(p1);
Karsten Hopp 88ac88
+ 
Karsten Hopp 88ac88
+ 			    str_arg_l = precision = p1 - (char_u *)str_arg;
Karsten Hopp 88ac88
+ 			}
Karsten Hopp 88ac88
+ 		    }
Karsten Hopp 88ac88
+ #endif
Karsten Hopp 88ac88
  		    break;
Karsten Hopp 88ac88
  
Karsten Hopp 88ac88
  		default:
Karsten Hopp 88ac88
*** ../vim-7.3.712/src/version.c	2012-10-23 05:35:30.000000000 +0200
Karsten Hopp 88ac88
--- src/version.c	2012-11-14 17:54:12.000000000 +0100
Karsten Hopp 88ac88
***************
Karsten Hopp 88ac88
*** 727,728 ****
Karsten Hopp 88ac88
--- 727,730 ----
Karsten Hopp 88ac88
  {   /* Add new patch number below this line */
Karsten Hopp 88ac88
+ /**/
Karsten Hopp 88ac88
+     713,
Karsten Hopp 88ac88
  /**/
Karsten Hopp 88ac88
Karsten Hopp 88ac88
-- 
Karsten Hopp 88ac88
In many of the more relaxed civilizations on the Outer Eastern Rim of the
Karsten Hopp 88ac88
Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the
Karsten Hopp 88ac88
great "Encyclopedia Galactica" as the standard repository of all knowledge
Karsten Hopp 88ac88
and wisdom, for though it has many omissions and contains much that is
Karsten Hopp 88ac88
apocryphal, or at least wildly inaccurate, it scores over the older, more
Karsten Hopp 88ac88
pedestrian work in two important respects.
Karsten Hopp 88ac88
First, it is slightly cheaper; and second, it has the words "DON'T PANIC"
Karsten Hopp 88ac88
inscribed in large friendly letters on its cover.
Karsten Hopp 88ac88
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp 88ac88
Karsten Hopp 88ac88
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 88ac88
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 88ac88
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 88ac88
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///