Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Patch 7.3.713
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bram Moolenaar  
View profile  
 More options Nov 14 2012, 12:13 pm
From: Bram Moolenaar <B...@Moolenaar.net>
Date: Wed, 14 Nov 2012 18:11:14 +0100
Local: Wed, Nov 14 2012 12:11 pm
Subject: Patch 7.3.713

Patch 7.3.713
Problem:    printf() can only align to bytes, not characters.
Solution:   Add the "S" item. (Christian Brabandt)
Files:      runtime/doc/eval.txt, src/message.c

*** ../vim-7.3.712/runtime/doc/eval.txt 2012-10-21 00:44:59.000000000 +0200
--- runtime/doc/eval.txt        2012-11-14 18:00:40.000000000 +0100
***************
*** 4427,4432 ****
--- 4451,4457 ----

                Often used items are:
                  %s    string
+                 %6S   string right-aligned in 6 display cells
                  %6s   string right-aligned in 6 bytes
                  %.9s  string truncated to 9 bytes
                  %c    single byte
***************
*** 4541,4546 ****
--- 4566,4575 ----
                s       The text of the String argument is used.  If a
                        precision is specified, no more bytes than the number
                        specified are used.
+               S       The text of the String argument is used.  If a
+                       precision is specified, no more display cells than the
+                       number specified are used.  Without the |+multi_byte|
+                       feature works just like 's'.

                                                        *printf-f* *E807*
                f       The Float argument is converted into a string of the
*** ../vim-7.3.712/src/message.c        2012-03-28 16:49:25.000000000 +0200
--- src/message.c       2012-11-14 17:58:25.000000000 +0100
***************
*** 4290,4295 ****
--- 4290,4296 ----
            case '%':
            case 'c':
            case 's':
+           case 'S':
                length_modifier = '\0';
                str_arg_l = 1;
                switch (fmt_spec)
***************
*** 4318,4323 ****
--- 4319,4325 ----
                    }

                case 's':
+               case 'S':
                    str_arg =
  #ifndef HAVE_STDARG_H
                                (char *)get_a_arg(arg_idx);
***************
*** 4354,4359 ****
--- 4356,4379 ----
                        str_arg_l = (q == NULL) ? precision
                                                      : (size_t)(q - str_arg);
                    }
+ #ifdef FEAT_MBYTE
+                   if (fmt_spec == 'S')
+                   {
+                       if (min_field_width != 0)
+                           min_field_width += STRLEN(str_arg)
+                                    - mb_string2cells((char_u *)str_arg, -1);
+                       if (precision)
+                       {
+                           char_u *p1 = (char_u *)str_arg;
+                           size_t i;
+
+                           for (i = 0; i < precision && *p1; i++)
+                               p1 += mb_ptr2len(p1);
+
+                           str_arg_l = precision = p1 - (char_u *)str_arg;
+                       }
+                   }
+ #endif
                    break;

                default:
*** ../vim-7.3.712/src/version.c        2012-10-23 05:35:30.000000000 +0200
--- src/version.c       2012-11-14 17:54:12.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
  {   /* Add new patch number below this line */
+ /**/
+     713,
  /**/

--
In many of the more relaxed civilizations on the Outer Eastern Rim of the
Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the
great "Encyclopedia Galactica" as the standard repository of all knowledge
and wisdom, for though it has many omissions and contains much that is
apocryphal, or at least wildly inaccurate, it scores over the older, more
pedestrian work in two important respects.
First, it is slightly cheaper; and second, it has the words "DON'T PANIC"
inscribed in large friendly letters on its cover.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »