]>
Commit | Line | Data |
---|---|---|
5a088057 KK |
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 | + | |
80 | + for (i = 0; i < precision && *p1; i++) | |
81 | + p1 += mb_ptr2len(p1); | |
82 | + | |
83 | + str_arg_l = precision = p1 - (char_u *)str_arg; | |
84 | + } | |
85 | + } | |
86 | + #endif | |
87 | break; | |
88 | ||
89 | default: | |
90 | *** ../vim-7.3.712/src/version.c 2012-10-23 05:35:30.000000000 +0200 | |
91 | --- src/version.c 2012-11-14 17:54:12.000000000 +0100 | |
92 | *************** | |
93 | *** 727,728 **** | |
94 | --- 727,730 ---- | |
95 | { /* Add new patch number below this line */ | |
96 | + /**/ | |
97 | + 713, | |
98 | /**/ | |
99 | ||
100 | -- | |
101 | In many of the more relaxed civilizations on the Outer Eastern Rim of the | |
102 | Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the | |
103 | great "Encyclopedia Galactica" as the standard repository of all knowledge | |
104 | and wisdom, for though it has many omissions and contains much that is | |
105 | apocryphal, or at least wildly inaccurate, it scores over the older, more | |
106 | pedestrian work in two important respects. | |
107 | First, it is slightly cheaper; and second, it has the words "DON'T PANIC" | |
108 | inscribed in large friendly letters on its cover. | |
109 | -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" | |
110 | ||
111 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
112 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
113 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
114 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |