| File wincon/pdcdisp.c changed (mode: 100644) (index 14418396..e3902c1e) |
| ... |
... |
void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) |
| 176 |
176 |
#else |
#else |
| 177 |
177 |
char buffer[512]; |
char buffer[512]; |
| 178 |
178 |
#endif |
#endif |
|
179 |
|
// Current offset in the output buffer, can be smaller than the offset |
|
180 |
|
// in the input buffer (j). |
|
181 |
|
int buf_len = 0; |
| 179 |
182 |
for (j = 0; j < len; j++) |
for (j = 0; j < len; j++) |
| 180 |
183 |
{ |
{ |
| 181 |
184 |
chtype ch = srcp[j]; |
chtype ch = srcp[j]; |
| |
| ... |
... |
void _new_packet(attr_t attr, int lineno, int x, int len, const chtype *srcp) |
| 191 |
194 |
if (blink && blinked_off) |
if (blink && blinked_off) |
| 192 |
195 |
ch = ' '; |
ch = ' '; |
| 193 |
196 |
|
|
| 194 |
|
buffer[j] = ch & A_CHARTEXT; |
|
|
197 |
|
buffer[buf_len] = ch & A_CHARTEXT; |
|
198 |
|
|
|
199 |
|
// In case of CJK characters input buffer is padded to account for |
|
200 |
|
// their width being larger than one. This allows most of the code |
|
201 |
|
// in the library which knows nothing of CJK to remain unchanged and |
|
202 |
|
// naturaly take real width of such characters into account without |
|
203 |
|
// handling them in any special way. However, need to jump over the |
|
204 |
|
// padding when drawing things to avoid having it in the output. |
|
205 |
|
int char_width = compat_wcwidth(buffer[buf_len]); |
|
206 |
|
if (char_width < 0) |
|
207 |
|
char_width = 1; |
|
208 |
|
j += char_width - 1; |
|
209 |
|
|
|
210 |
|
++buf_len; |
| 195 |
211 |
} |
} |
| 196 |
212 |
|
|
| 197 |
213 |
PDC_gotoyx(lineno, x); |
PDC_gotoyx(lineno, x); |
| 198 |
214 |
_set_ansi_color(fore, back, attr); |
_set_ansi_color(fore, back, attr); |
| 199 |
215 |
#ifdef PDC_WIDE |
#ifdef PDC_WIDE |
| 200 |
|
WriteConsoleW(pdc_con_out, buffer, len, NULL, NULL); |
|
|
216 |
|
WriteConsoleW(pdc_con_out, buffer, buf_len, NULL, NULL); |
| 201 |
217 |
#else |
#else |
| 202 |
|
WriteConsoleA(pdc_con_out, buffer, len, NULL, NULL); |
|
|
218 |
|
WriteConsoleA(pdc_con_out, buffer, buf_len, NULL, NULL); |
| 203 |
219 |
#endif |
#endif |
| 204 |
220 |
} |
} |
| 205 |
221 |
else |
else |