comparison src/xdisp.c @ 105245:41de8bc6a7be

(get_next_display_element): Use an enum in last change.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 28 Sep 2009 02:01:52 +0000
parents 0f5cfebf2252
children 882ce3b1b1bd
comparison
equal deleted inserted replaced
105244:1308a0fb85e9 105245:41de8bc6a7be
5682 it? */ 5682 it? */
5683 if (success_p && it->dpvec == NULL) 5683 if (success_p && it->dpvec == NULL)
5684 { 5684 {
5685 Lisp_Object dv; 5685 Lisp_Object dv;
5686 struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte); 5686 struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte);
5687 int nbsp_or_shy = 0; /* 1:NO-BREAK SPACE, 2:SOFT HYPHEN, 0:ELSE */ 5687 enum { char_is_other = 0, char_is_nbsp, char_is_soft_hyphen }
5688 #define IS_NBSP (nbsp_or_shy == 1) 5688 nbsp_or_shy = char_is_other;
5689 #define IS_SHY (nbsp_or_shy == 2)
5690 int decoded = it->c; 5689 int decoded = it->c;
5691 5690
5692 if (it->dp 5691 if (it->dp
5693 && (dv = DISP_CHAR_VECTOR (it->dp, it->c), 5692 && (dv = DISP_CHAR_VECTOR (it->dp, it->c),
5694 VECTORP (dv))) 5693 VECTORP (dv)))
5721 decoded = DECODE_CHAR (unibyte, it->c); 5720 decoded = DECODE_CHAR (unibyte, it->c);
5722 5721
5723 if (it->c >= 0x80 && ! NILP (Vnobreak_char_display)) 5722 if (it->c >= 0x80 && ! NILP (Vnobreak_char_display))
5724 { 5723 {
5725 if (it->multibyte_p) 5724 if (it->multibyte_p)
5726 nbsp_or_shy = it->c == 0xA0 ? 1 : it->c == 0xAD ? 2 : 0; 5725 nbsp_or_shy = (it->c == 0xA0 ? char_is_nbsp
5726 : it->c == 0xAD ? char_is_soft_hyphen
5727 : char_is_other);
5727 else if (unibyte_display_via_language_environment) 5728 else if (unibyte_display_via_language_environment)
5728 nbsp_or_shy = decoded == 0xA0 ? 1 : decoded == 0xAD ? 2 : 0; 5729 nbsp_or_shy = (decoded == 0xA0 ? char_is_nbsp
5730 : decoded == 0xAD ? char_is_soft_hyphen
5731 : char_is_other);
5729 } 5732 }
5730 5733
5731 /* Translate control characters into `\003' or `^C' form. 5734 /* Translate control characters into `\003' or `^C' form.
5732 Control characters coming from a display table entry are 5735 Control characters coming from a display table entry are
5733 currently not translated because we use IT->dpvec to hold 5736 currently not translated because we use IT->dpvec to hold
5806 5809
5807 /* Handle non-break space in the mode where it only gets 5810 /* Handle non-break space in the mode where it only gets
5808 highlighting. */ 5811 highlighting. */
5809 5812
5810 if (EQ (Vnobreak_char_display, Qt) 5813 if (EQ (Vnobreak_char_display, Qt)
5811 && IS_NBSP) 5814 && nbsp_or_shy == char_is_nbsp)
5812 { 5815 {
5813 /* Merge the no-break-space face into the current face. */ 5816 /* Merge the no-break-space face into the current face. */
5814 face_id = merge_faces (it->f, Qnobreak_space, 0, 5817 face_id = merge_faces (it->f, Qnobreak_space, 0,
5815 it->face_id); 5818 it->face_id);
5816 5819
5856 5859
5857 /* Handle soft hyphens in the mode where they only get 5860 /* Handle soft hyphens in the mode where they only get
5858 highlighting. */ 5861 highlighting. */
5859 5862
5860 if (EQ (Vnobreak_char_display, Qt) 5863 if (EQ (Vnobreak_char_display, Qt)
5861 && IS_SHY) 5864 && nbsp_or_shy == char_is_soft_hyphen)
5862 { 5865 {
5863 it->c = '-'; 5866 it->c = '-';
5864 XSETINT (it->ctl_chars[0], '-'); 5867 XSETINT (it->ctl_chars[0], '-');
5865 ctl_len = 1; 5868 ctl_len = 1;
5866 goto display_control; 5869 goto display_control;
5870 with the escape glyph. */ 5873 with the escape glyph. */
5871 5874
5872 if (nbsp_or_shy) 5875 if (nbsp_or_shy)
5873 { 5876 {
5874 XSETINT (it->ctl_chars[0], escape_glyph); 5877 XSETINT (it->ctl_chars[0], escape_glyph);
5875 it->c = (IS_NBSP ? ' ' : '-'); 5878 it->c = (nbsp_or_shy == char_is_nbsp ? ' ' : '-');
5876 XSETINT (it->ctl_chars[1], it->c); 5879 XSETINT (it->ctl_chars[1], it->c);
5877 ctl_len = 2; 5880 ctl_len = 2;
5878 goto display_control; 5881 goto display_control;
5879 } 5882 }
5880 5883