]>
Commit | Line | Data |
---|---|---|
c6060300 MT |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.440 | |
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.440 | |
11 | Problem: Vim does not support UTF8_STRING for the X selection. | |
12 | Solution: Add UTF8_STRING atom support. (Alex Efros) Use it only when | |
13 | 'encoding' is set to Unicode. | |
14 | Files: src/ui.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.439/src/ui.c 2012-02-04 21:57:44.000000000 +0100 | |
18 | --- src/ui.c 2012-02-12 01:28:30.000000000 +0100 | |
19 | *************** | |
20 | *** 1917,1922 **** | |
21 | --- 1917,1923 ---- | |
22 | static Atom vim_atom; /* Vim's own special selection format */ | |
23 | #ifdef FEAT_MBYTE | |
24 | static Atom vimenc_atom; /* Vim's extended selection format */ | |
25 | + static Atom utf8_atom; | |
26 | #endif | |
27 | static Atom compound_text_atom; | |
28 | static Atom text_atom; | |
29 | *************** | |
30 | *** 1930,1935 **** | |
31 | --- 1931,1937 ---- | |
32 | vim_atom = XInternAtom(dpy, VIM_ATOM_NAME, False); | |
33 | #ifdef FEAT_MBYTE | |
34 | vimenc_atom = XInternAtom(dpy, VIMENC_ATOM_NAME,False); | |
35 | + utf8_atom = XInternAtom(dpy, "UTF8_STRING", False); | |
36 | #endif | |
37 | compound_text_atom = XInternAtom(dpy, "COMPOUND_TEXT", False); | |
38 | text_atom = XInternAtom(dpy, "TEXT", False); | |
39 | *************** | |
40 | *** 2074,2080 **** | |
41 | } | |
42 | #endif | |
43 | ||
44 | ! else if (*type == compound_text_atom || ( | |
45 | #ifdef FEAT_MBYTE | |
46 | enc_dbcs != 0 && | |
47 | #endif | |
48 | --- 2076,2086 ---- | |
49 | } | |
50 | #endif | |
51 | ||
52 | ! else if (*type == compound_text_atom | |
53 | ! #ifdef FEAT_MBYTE | |
54 | ! || *type == utf8_atom | |
55 | ! #endif | |
56 | ! || ( | |
57 | #ifdef FEAT_MBYTE | |
58 | enc_dbcs != 0 && | |
59 | #endif | |
60 | *************** | |
61 | *** 2128,2134 **** | |
62 | #else | |
63 | 1 | |
64 | #endif | |
65 | ! ; i < 5; i++) | |
66 | { | |
67 | switch (i) | |
68 | { | |
69 | --- 2134,2140 ---- | |
70 | #else | |
71 | 1 | |
72 | #endif | |
73 | ! ; i < 6; i++) | |
74 | { | |
75 | switch (i) | |
76 | { | |
77 | *************** | |
78 | *** 2136,2145 **** | |
79 | case 0: type = vimenc_atom; break; | |
80 | #endif | |
81 | case 1: type = vim_atom; break; | |
82 | ! case 2: type = compound_text_atom; break; | |
83 | ! case 3: type = text_atom; break; | |
84 | default: type = XA_STRING; | |
85 | } | |
86 | success = MAYBE; | |
87 | XtGetSelectionValue(myShell, cbd->sel_atom, type, | |
88 | clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime); | |
89 | --- 2142,2159 ---- | |
90 | case 0: type = vimenc_atom; break; | |
91 | #endif | |
92 | case 1: type = vim_atom; break; | |
93 | ! #ifdef FEAT_MBYTE | |
94 | ! case 2: type = utf8_atom; break; | |
95 | ! #endif | |
96 | ! case 3: type = compound_text_atom; break; | |
97 | ! case 4: type = text_atom; break; | |
98 | default: type = XA_STRING; | |
99 | } | |
100 | + #ifdef FEAT_MBYTE | |
101 | + if (type == utf8_atom && !enc_utf8) | |
102 | + /* Only request utf-8 when 'encoding' is utf8. */ | |
103 | + continue; | |
104 | + #endif | |
105 | success = MAYBE; | |
106 | XtGetSelectionValue(myShell, cbd->sel_atom, type, | |
107 | clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime); | |
108 | *************** | |
109 | *** 2230,2247 **** | |
110 | { | |
111 | Atom *array; | |
112 | ||
113 | ! if ((array = (Atom *)XtMalloc((unsigned)(sizeof(Atom) * 6))) == NULL) | |
114 | return False; | |
115 | *value = (XtPointer)array; | |
116 | i = 0; | |
117 | - array[i++] = XA_STRING; | |
118 | array[i++] = targets_atom; | |
119 | #ifdef FEAT_MBYTE | |
120 | array[i++] = vimenc_atom; | |
121 | #endif | |
122 | array[i++] = vim_atom; | |
123 | array[i++] = text_atom; | |
124 | array[i++] = compound_text_atom; | |
125 | *type = XA_ATOM; | |
126 | /* This used to be: *format = sizeof(Atom) * 8; but that caused | |
127 | * crashes on 64 bit machines. (Peter Derr) */ | |
128 | --- 2244,2266 ---- | |
129 | { | |
130 | Atom *array; | |
131 | ||
132 | ! if ((array = (Atom *)XtMalloc((unsigned)(sizeof(Atom) * 7))) == NULL) | |
133 | return False; | |
134 | *value = (XtPointer)array; | |
135 | i = 0; | |
136 | array[i++] = targets_atom; | |
137 | #ifdef FEAT_MBYTE | |
138 | array[i++] = vimenc_atom; | |
139 | #endif | |
140 | array[i++] = vim_atom; | |
141 | + #ifdef FEAT_MBYTE | |
142 | + if (enc_utf8) | |
143 | + array[i++] = utf8_atom; | |
144 | + #endif | |
145 | + array[i++] = XA_STRING; | |
146 | array[i++] = text_atom; | |
147 | array[i++] = compound_text_atom; | |
148 | + | |
149 | *type = XA_ATOM; | |
150 | /* This used to be: *format = sizeof(Atom) * 8; but that caused | |
151 | * crashes on 64 bit machines. (Peter Derr) */ | |
152 | *************** | |
153 | *** 2253,2258 **** | |
154 | --- 2272,2278 ---- | |
155 | if ( *target != XA_STRING | |
156 | #ifdef FEAT_MBYTE | |
157 | && *target != vimenc_atom | |
158 | + && *target != utf8_atom | |
159 | #endif | |
160 | && *target != vim_atom | |
161 | && *target != text_atom | |
162 | *************** | |
163 | *** 2282,2294 **** | |
164 | return False; | |
165 | } | |
166 | ||
167 | ! if (*target == XA_STRING) | |
168 | { | |
169 | mch_memmove(result, string, (size_t)(*length)); | |
170 | ! *type = XA_STRING; | |
171 | } | |
172 | ! else if (*target == compound_text_atom | |
173 | ! || *target == text_atom) | |
174 | { | |
175 | XTextProperty text_prop; | |
176 | char *string_nt = (char *)alloc((unsigned)*length + 1); | |
177 | --- 2302,2317 ---- | |
178 | return False; | |
179 | } | |
180 | ||
181 | ! if (*target == XA_STRING | |
182 | ! #ifdef FEAT_MBYTE | |
183 | ! || (*target == utf8_atom && enc_utf8) | |
184 | ! #endif | |
185 | ! ) | |
186 | { | |
187 | mch_memmove(result, string, (size_t)(*length)); | |
188 | ! *type = *target; | |
189 | } | |
190 | ! else if (*target == compound_text_atom || *target == text_atom) | |
191 | { | |
192 | XTextProperty text_prop; | |
193 | char *string_nt = (char *)alloc((unsigned)*length + 1); | |
194 | *** ../vim-7.3.439/src/version.c 2012-02-12 00:31:47.000000000 +0100 | |
195 | --- src/version.c 2012-02-12 01:34:22.000000000 +0100 | |
196 | *************** | |
197 | *** 716,717 **** | |
198 | --- 716,719 ---- | |
199 | { /* Add new patch number below this line */ | |
200 | + /**/ | |
201 | + 440, | |
202 | /**/ | |
203 | ||
204 | -- | |
205 | hundred-and-one symptoms of being an internet addict: | |
206 | 42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth. | |
207 | ||
208 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
209 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
210 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
211 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |