home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.713 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  3.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.713
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.713
  11. Problem:    printf() can only align to bytes, not characters.
  12. Solution:   Add the "S" item. (Christian Brabandt)
  13. Files:        runtime/doc/eval.txt, src/message.c
  14.  
  15.  
  16. *** ../vim-7.3.712/runtime/doc/eval.txt    2012-10-21 00:44:59.000000000 +0200
  17. --- runtime/doc/eval.txt    2012-11-14 18:00:40.000000000 +0100
  18. ***************
  19. *** 4427,4432 ****
  20. --- 4451,4457 ----
  21.   
  22.           Often used items are:
  23.             %s    string
  24. +           %6S    string right-aligned in 6 display cells
  25.             %6s    string right-aligned in 6 bytes
  26.             %.9s    string truncated to 9 bytes
  27.             %c    single byte
  28. ***************
  29. *** 4541,4546 ****
  30. --- 4566,4575 ----
  31.           s    The text of the String argument is used.  If a
  32.               precision is specified, no more bytes than the number
  33.               specified are used.
  34. +         S    The text of the String argument is used.  If a
  35. +             precision is specified, no more display cells than the
  36. +             number specified are used.  Without the |+multi_byte|
  37. +             feature works just like 's'.
  38.   
  39.                               *printf-f* *E807*
  40.           f    The Float argument is converted into a string of the 
  41. *** ../vim-7.3.712/src/message.c    2012-03-28 16:49:25.000000000 +0200
  42. --- src/message.c    2012-11-14 17:58:25.000000000 +0100
  43. ***************
  44. *** 4290,4295 ****
  45. --- 4290,4296 ----
  46.           case '%':
  47.           case 'c':
  48.           case 's':
  49. +         case 'S':
  50.           length_modifier = '\0';
  51.           str_arg_l = 1;
  52.           switch (fmt_spec)
  53. ***************
  54. *** 4318,4323 ****
  55. --- 4319,4325 ----
  56.               }
  57.   
  58.           case 's':
  59. +         case 'S':
  60.               str_arg =
  61.   #ifndef HAVE_STDARG_H
  62.                   (char *)get_a_arg(arg_idx);
  63. ***************
  64. *** 4354,4359 ****
  65. --- 4356,4379 ----
  66.               str_arg_l = (q == NULL) ? precision
  67.                                 : (size_t)(q - str_arg);
  68.               }
  69. + #ifdef FEAT_MBYTE
  70. +             if (fmt_spec == 'S')
  71. +             {
  72. +             if (min_field_width != 0)
  73. +                 min_field_width += STRLEN(str_arg)
  74. +                      - mb_string2cells((char_u *)str_arg, -1);
  75. +             if (precision)
  76. +             {
  77. +                 char_u *p1 = (char_u *)str_arg;
  78. +                 size_t i;
  79. +                 for (i = 0; i < precision && *p1; i++)
  80. +                 p1 += mb_ptr2len(p1);
  81. +                 str_arg_l = precision = p1 - (char_u *)str_arg;
  82. +             }
  83. +             }
  84. + #endif
  85.               break;
  86.   
  87.           default:
  88. *** ../vim-7.3.712/src/version.c    2012-10-23 05:35:30.000000000 +0200
  89. --- src/version.c    2012-11-14 17:54:12.000000000 +0100
  90. ***************
  91. *** 727,728 ****
  92. --- 727,730 ----
  93.   {   /* Add new patch number below this line */
  94. + /**/
  95. +     713,
  96.   /**/
  97.  
  98. -- 
  99. In many of the more relaxed civilizations on the Outer Eastern Rim of the
  100. Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the
  101. great "Encyclopedia Galactica" as the standard repository of all knowledge
  102. and wisdom, for though it has many omissions and contains much that is
  103. apocryphal, or at least wildly inaccurate, it scores over the older, more
  104. pedestrian work in two important respects.
  105. First, it is slightly cheaper; and second, it has the words "DON'T PANIC"
  106. inscribed in large friendly letters on its cover.
  107.         -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
  108.  
  109.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  110. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  111. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  112.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  113.