diff options
| author | Kenichi Handa | 1999-09-03 01:28:42 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-09-03 01:28:42 +0000 |
| commit | 197516c20d6a23ba998c657139026b2545c968d9 (patch) | |
| tree | bb1cec9aab6911f399dbecb31eabc504d7f7b52c /src | |
| parent | 665111a6383ea647b513a2b431acd25b7e3ef57e (diff) | |
| download | emacs-197516c20d6a23ba998c657139026b2545c968d9.tar.gz emacs-197516c20d6a23ba998c657139026b2545c968d9.zip | |
(get_next_display_element): Display incomplete multibyte
sequence (e.g. \222\300) by octal form.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index f803ce3027e..921ce82b390 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3309,12 +3309,16 @@ get_next_display_element (it) | |||
| 3309 | Control characters coming from a display table entry are | 3309 | Control characters coming from a display table entry are |
| 3310 | currently not translated because we use IT->dpvec to hold | 3310 | currently not translated because we use IT->dpvec to hold |
| 3311 | the translation. This could easily be changed but I | 3311 | the translation. This could easily be changed but I |
| 3312 | don't believe that it is worth doing. */ | 3312 | don't believe that it is worth doing. |
| 3313 | |||
| 3314 | Non-printable multibyte characters are also translated | ||
| 3315 | octal form. */ | ||
| 3313 | else if ((it->c < ' ' | 3316 | else if ((it->c < ' ' |
| 3314 | && (it->area != TEXT_AREA | 3317 | && (it->area != TEXT_AREA |
| 3315 | || (it->c != '\n' && it->c != '\t'))) | 3318 | || (it->c != '\n' && it->c != '\t'))) |
| 3316 | || (it->c >= 127 | 3319 | || (it->c >= 127 |
| 3317 | && it->len == 1)) | 3320 | && it->len == 1) |
| 3321 | || !CHAR_PRINTABLE_P (it->c)) | ||
| 3318 | { | 3322 | { |
| 3319 | /* IT->c is a control character which must be displayed | 3323 | /* IT->c is a control character which must be displayed |
| 3320 | either as '\003' or as `^C' where the '\\' and '^' | 3324 | either as '\003' or as `^C' where the '\\' and '^' |
| @@ -3347,29 +3351,37 @@ get_next_display_element (it) | |||
| 3347 | } | 3351 | } |
| 3348 | else | 3352 | else |
| 3349 | { | 3353 | { |
| 3354 | unsigned char work[4], *str; | ||
| 3355 | int len = CHAR_STRING (it->c, work, str); | ||
| 3356 | int i; | ||
| 3357 | GLYPH escape_glyph; | ||
| 3358 | |||
| 3350 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ | 3359 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ |
| 3351 | if (it->dp | 3360 | if (it->dp |
| 3352 | && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) | 3361 | && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) |
| 3353 | && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) | 3362 | && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) |
| 3354 | g = XFASTINT (DISP_ESCAPE_GLYPH (it->dp)); | 3363 | escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp)); |
| 3355 | else | 3364 | else |
| 3356 | g = FAST_MAKE_GLYPH ('\\', 0); | 3365 | escape_glyph = FAST_MAKE_GLYPH ('\\', 0); |
| 3357 | XSETINT (it->ctl_chars[0], g); | ||
| 3358 | 3366 | ||
| 3359 | /* Insert three more glyphs into IT->ctl_chars for | 3367 | for (i = 0; i < len; i++) |
| 3360 | the octal display of the character. */ | 3368 | { |
| 3361 | g = FAST_MAKE_GLYPH (((it->c >> 6) & 7) + '0', 0); | 3369 | XSETINT (it->ctl_chars[i * 4], escape_glyph); |
| 3362 | XSETINT (it->ctl_chars[1], g); | 3370 | /* Insert three more glyphs into IT->ctl_chars for |
| 3363 | g = FAST_MAKE_GLYPH (((it->c >> 3) & 7) + '0', 0); | 3371 | the octal display of the character. */ |
| 3364 | XSETINT (it->ctl_chars[2], g); | 3372 | g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', 0); |
| 3365 | g = FAST_MAKE_GLYPH ((it->c & 7) + '0', 0); | 3373 | XSETINT (it->ctl_chars[i * 4 + 1], g); |
| 3366 | XSETINT (it->ctl_chars[3], g); | 3374 | g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', 0); |
| 3375 | XSETINT (it->ctl_chars[i * 4 + 2], g); | ||
| 3376 | g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0); | ||
| 3377 | XSETINT (it->ctl_chars[i * 4 + 3], g); | ||
| 3378 | } | ||
| 3367 | 3379 | ||
| 3368 | /* Set up IT->dpvec and return the first character | 3380 | /* Set up IT->dpvec and return the first character |
| 3369 | from it. */ | 3381 | from it. */ |
| 3370 | it->dpvec_char_len = it->len; | 3382 | it->dpvec_char_len = it->len; |
| 3371 | it->dpvec = it->ctl_chars; | 3383 | it->dpvec = it->ctl_chars; |
| 3372 | it->dpend = it->dpvec + 4; | 3384 | it->dpend = it->dpvec + len * 4; |
| 3373 | it->current.dpvec_index = 0; | 3385 | it->current.dpvec_index = 0; |
| 3374 | it->method = next_element_from_display_vector; | 3386 | it->method = next_element_from_display_vector; |
| 3375 | get_next_display_element (it); | 3387 | get_next_display_element (it); |