comparison src/xdisp.c @ 25500:156172362ea9

(get_next_display_element): Display incomplete multibyte sequence (e.g. \222\300) by octal form.
author Kenichi Handa <handa@m17n.org>
date Fri, 03 Sep 1999 01:28:42 +0000
parents 28588533d342
children 5e59e2bd26b5
comparison
equal deleted inserted replaced
25499:623bd80885a4 25500:156172362ea9
3307 3307
3308 /* Translate control characters into `\003' or `^C' form. 3308 /* Translate control characters into `\003' or `^C' form.
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 '^'
3321 can be defined in the display table. Fill 3325 can be defined in the display table. Fill
3322 IT->ctl_chars with glyphs for what we have to 3326 IT->ctl_chars with glyphs for what we have to
3345 it->method = next_element_from_display_vector; 3349 it->method = next_element_from_display_vector;
3346 get_next_display_element (it); 3350 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); 3366
3358 3367 for (i = 0; i < len; i++)
3359 /* Insert three more glyphs into IT->ctl_chars for 3368 {
3360 the octal display of the character. */ 3369 XSETINT (it->ctl_chars[i * 4], escape_glyph);
3361 g = FAST_MAKE_GLYPH (((it->c >> 6) & 7) + '0', 0); 3370 /* Insert three more glyphs into IT->ctl_chars for
3362 XSETINT (it->ctl_chars[1], g); 3371 the octal display of the character. */
3363 g = FAST_MAKE_GLYPH (((it->c >> 3) & 7) + '0', 0); 3372 g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', 0);
3364 XSETINT (it->ctl_chars[2], g); 3373 XSETINT (it->ctl_chars[i * 4 + 1], g);
3365 g = FAST_MAKE_GLYPH ((it->c & 7) + '0', 0); 3374 g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', 0);
3366 XSETINT (it->ctl_chars[3], g); 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);
3376 } 3388 }
3377 } 3389 }