aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-03-21 00:41:41 +0000
committerKenichi Handa2000-03-21 00:41:41 +0000
commit980806b6cf81749205ddc50c81d5fd72ebe1e9d3 (patch)
tree84bd110dbc13a20b008b5b8f654867920f68a9a0 /src
parentb8c434926b8f40cd7bc1aa51a440b6a7c88c6fe4 (diff)
downloademacs-980806b6cf81749205ddc50c81d5fd72ebe1e9d3.tar.gz
emacs-980806b6cf81749205ddc50c81d5fd72ebe1e9d3.zip
(charset_at_position): Function removed.
(init_iterator): Don't set member charset of struct `it'. (handle_face_prop, reseat_to_string, set_iterator_to_next, next_element_from_display_vector, insert_left_trunc_glyphs): Likewise. (face_before_or_after_it_pos): Call FACE_FOR_CHAR, not FACE_FOR_CHARSET. (get_next_display_element, append_space, extend_face_to_end_of_line): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c90
1 files changed, 23 insertions, 67 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 3a3285e626d..12c95051436 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -664,7 +664,6 @@ static void init_from_display_pos P_ ((struct it *, struct window *,
664 struct display_pos *)); 664 struct display_pos *));
665static void reseat_to_string P_ ((struct it *, unsigned char *, 665static void reseat_to_string P_ ((struct it *, unsigned char *,
666 Lisp_Object, int, int, int, int)); 666 Lisp_Object, int, int, int, int));
667static int charset_at_position P_ ((struct text_pos));
668static enum move_it_result move_it_in_display_line_to P_ ((struct it *, 667static enum move_it_result move_it_in_display_line_to P_ ((struct it *,
669 int, int, int)); 668 int, int, int));
670void move_it_vertically_backward P_ ((struct it *, int)); 669void move_it_vertically_backward P_ ((struct it *, int));
@@ -1029,31 +1028,6 @@ compute_string_pos (newpos, pos, string)
1029} 1028}
1030 1029
1031 1030
1032/* Return the charset of the character at position POS in
1033 current_buffer. */
1034
1035static int
1036charset_at_position (pos)
1037 struct text_pos pos;
1038{
1039 int c, multibyte_p;
1040 unsigned char *p = BYTE_POS_ADDR (BYTEPOS (pos));
1041
1042 multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
1043 if (multibyte_p)
1044 {
1045 int maxlen = ((BYTEPOS (pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE)
1046 - BYTEPOS (pos));
1047 int len;
1048 c = string_char_and_length (p, maxlen, &len);
1049 }
1050 else
1051 c = *p;
1052
1053 return CHAR_CHARSET (c);
1054}
1055
1056
1057 1031
1058/*********************************************************************** 1032/***********************************************************************
1059 Lisp form evaluation 1033 Lisp form evaluation
@@ -1214,7 +1188,6 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
1214 bzero (it, sizeof *it); 1188 bzero (it, sizeof *it);
1215 it->current.overlay_string_index = -1; 1189 it->current.overlay_string_index = -1;
1216 it->current.dpvec_index = -1; 1190 it->current.dpvec_index = -1;
1217 it->charset = CHARSET_ASCII;
1218 it->base_face_id = base_face_id; 1191 it->base_face_id = base_face_id;
1219 1192
1220 /* The window in which we iterate over current_buffer: */ 1193 /* The window in which we iterate over current_buffer: */
@@ -1921,7 +1894,6 @@ handle_face_prop (it)
1921 } 1894 }
1922 1895
1923 it->face_id = new_face_id; 1896 it->face_id = new_face_id;
1924 it->charset = CHARSET_ASCII;
1925 return HANDLED_NORMALLY; 1897 return HANDLED_NORMALLY;
1926} 1898}
1927 1899
@@ -1980,12 +1952,11 @@ face_before_or_after_it_pos (it, before_p)
1980 { 1952 {
1981 unsigned char *p = XSTRING (it->string)->data + BYTEPOS (pos); 1953 unsigned char *p = XSTRING (it->string)->data + BYTEPOS (pos);
1982 int rest = STRING_BYTES (XSTRING (it->string)) - BYTEPOS (pos); 1954 int rest = STRING_BYTES (XSTRING (it->string)) - BYTEPOS (pos);
1983 int c, len, charset; 1955 int c, len;
1956 struct face *face = FACE_FROM_ID (it->f, face_id);
1984 1957
1985 c = string_char_and_length (p, rest, &len); 1958 c = string_char_and_length (p, rest, &len);
1986 charset = CHAR_CHARSET (c); 1959 face_id = FACE_FOR_CHAR (it->f, face, c);
1987 if (charset != CHARSET_ASCII)
1988 face_id = FACE_FOR_CHARSET (it->f, face_id, charset);
1989 } 1960 }
1990 } 1961 }
1991 else 1962 else
@@ -2021,9 +1992,9 @@ face_before_or_after_it_pos (it, before_p)
2021 suitable for unibyte text if current_buffer is unibyte. */ 1992 suitable for unibyte text if current_buffer is unibyte. */
2022 if (it->multibyte_p) 1993 if (it->multibyte_p)
2023 { 1994 {
2024 int charset = charset_at_position (pos); 1995 int c = FETCH_MULTIBYTE_CHAR (CHARPOS (pos));
2025 if (charset != CHARSET_ASCII) 1996 struct face *face = FACE_FROM_ID (it->f, face_id);
2026 face_id = FACE_FOR_CHARSET (it->f, face_id, charset); 1997 face_id = FACE_FOR_CHAR (it->f, face, c);
2027 } 1998 }
2028 } 1999 }
2029 2000
@@ -3259,7 +3230,6 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
3259 bzero (&it->current, sizeof it->current); 3230 bzero (&it->current, sizeof it->current);
3260 it->current.overlay_string_index = -1; 3231 it->current.overlay_string_index = -1;
3261 it->current.dpvec_index = -1; 3232 it->current.dpvec_index = -1;
3262 it->charset = CHARSET_ASCII;
3263 xassert (charpos >= 0); 3233 xassert (charpos >= 0);
3264 3234
3265 /* Use the setting of MULTIBYTE if specified. */ 3235 /* Use the setting of MULTIBYTE if specified. */
@@ -3338,7 +3308,6 @@ get_next_display_element (it)
3338 function pointer `method' used here turns out to be faster than 3308 function pointer `method' used here turns out to be faster than
3339 using a sequence of if-statements. */ 3309 using a sequence of if-statements. */
3340 int success_p = (*it->method) (it); 3310 int success_p = (*it->method) (it);
3341 int charset;
3342 3311
3343 if (it->what == IT_CHARACTER) 3312 if (it->what == IT_CHARACTER)
3344 { 3313 {
@@ -3460,16 +3429,14 @@ get_next_display_element (it)
3460 } 3429 }
3461 } 3430 }
3462 3431
3463 /* Adjust face id if charset changes. There are no charset 3432 /* Adjust face id for a multibyte character. There are no
3464 changes in unibyte text because Emacs' charsets are not 3433 multibyte character in unibyte text. */
3465 applicable there. */
3466 if (it->multibyte_p 3434 if (it->multibyte_p
3467 && success_p 3435 && success_p
3468 && (charset = CHAR_CHARSET (it->c), 3436 && FRAME_WINDOW_P (it->f))
3469 charset != it->charset))
3470 { 3437 {
3471 it->charset = charset; 3438 struct face *face = FACE_FROM_ID (it->f, it->face_id);
3472 it->face_id = FACE_FOR_CHARSET (it->f, it->face_id, charset); 3439 it->face_id = FACE_FOR_CHAR (it->f, face, it->c);
3473 } 3440 }
3474 } 3441 }
3475 3442
@@ -3555,11 +3522,9 @@ set_iterator_to_next (it)
3555 strings. */ 3522 strings. */
3556 ++it->current.dpvec_index; 3523 ++it->current.dpvec_index;
3557 3524
3558 /* Restore face and charset of the iterator to what they were 3525 /* Restore face of the iterator to what they were before the
3559 before the display vector entry (these entries may contain 3526 display vector entry (these entries may contain faces). */
3560 faces, and of course characters of different charsets). */
3561 it->face_id = it->saved_face_id; 3527 it->face_id = it->saved_face_id;
3562 it->charset = FACE_FROM_ID (it->f, it->face_id)->charset;
3563 3528
3564 if (it->dpvec + it->current.dpvec_index == it->dpend) 3529 if (it->dpvec + it->current.dpvec_index == it->dpend)
3565 { 3530 {
@@ -3680,7 +3645,6 @@ next_element_from_display_vector (it)
3680 if (face_id >= 0) 3645 if (face_id >= 0)
3681 { 3646 {
3682 it->face_id = face_id; 3647 it->face_id = face_id;
3683 it->charset = CHARSET_ASCII;
3684 } 3648 }
3685 } 3649 }
3686 } 3650 }
@@ -10809,7 +10773,6 @@ insert_left_trunc_glyphs (it)
10809 10773
10810 /* Get the truncation glyphs. */ 10774 /* Get the truncation glyphs. */
10811 truncate_it = *it; 10775 truncate_it = *it;
10812 truncate_it.charset = -1;
10813 truncate_it.current_x = 0; 10776 truncate_it.current_x = 0;
10814 truncate_it.face_id = DEFAULT_FACE_ID; 10777 truncate_it.face_id = DEFAULT_FACE_ID;
10815 truncate_it.glyph_row = &scratch_glyph_row; 10778 truncate_it.glyph_row = &scratch_glyph_row;
@@ -10965,8 +10928,8 @@ append_space (it, default_face_p)
10965 struct text_pos saved_pos; 10928 struct text_pos saved_pos;
10966 int saved_what = it->what; 10929 int saved_what = it->what;
10967 int saved_face_id = it->face_id; 10930 int saved_face_id = it->face_id;
10968 int saved_charset = it->charset;
10969 Lisp_Object saved_object; 10931 Lisp_Object saved_object;
10932 struct face *face;
10970 10933
10971 saved_object = it->object; 10934 saved_object = it->object;
10972 saved_pos = it->position; 10935 saved_pos = it->position;
@@ -10976,14 +10939,11 @@ append_space (it, default_face_p)
10976 it->object = 0; 10939 it->object = 0;
10977 it->c = ' '; 10940 it->c = ' ';
10978 it->len = 1; 10941 it->len = 1;
10979 it->charset = CHARSET_ASCII;
10980 10942
10981 if (default_face_p) 10943 if (default_face_p)
10982 it->face_id = DEFAULT_FACE_ID; 10944 it->face_id = DEFAULT_FACE_ID;
10983 if (it->multibyte_p) 10945 face = FACE_FROM_ID (it->f, it->face_id);
10984 it->face_id = FACE_FOR_CHARSET (it->f, it->face_id, CHARSET_ASCII); 10946 it->face_id = FACE_FOR_CHAR (it->f, face, 0);
10985 else
10986 it->face_id = FACE_FOR_CHARSET (it->f, it->face_id, -1);
10987 10947
10988 PRODUCE_GLYPHS (it); 10948 PRODUCE_GLYPHS (it);
10989 10949
@@ -10992,7 +10952,6 @@ append_space (it, default_face_p)
10992 it->position = saved_pos; 10952 it->position = saved_pos;
10993 it->what = saved_what; 10953 it->what = saved_what;
10994 it->face_id = saved_face_id; 10954 it->face_id = saved_face_id;
10995 it->charset = saved_charset;
10996 return 1; 10955 return 1;
10997 } 10956 }
10998 } 10957 }
@@ -11031,15 +10990,13 @@ extend_face_to_end_of_line (it)
11031 in the text area has to be drawn to the end of the text area. */ 10990 in the text area has to be drawn to the end of the text area. */
11032 it->glyph_row->fill_line_p = 1; 10991 it->glyph_row->fill_line_p = 1;
11033 10992
11034 /* If current charset of IT is not ASCII, make sure we have the 10993 /* If current character of IT is not ASCII, make sure we have the
11035 ASCII face. This will be automatically undone the next time 10994 ASCII face. This will be automatically undone the next time
11036 get_next_display_element returns a character from a different 10995 get_next_display_element returns a multibyte character. Note
11037 charset. Note that the charset will always be ASCII in unibyte 10996 that the character will always be single byte in unibyte text. */
11038 text. */ 10997 if (!SINGLE_BYTE_CHAR_P (it->c))
11039 if (it->charset != CHARSET_ASCII)
11040 { 10998 {
11041 it->charset = CHARSET_ASCII; 10999 it->face_id = FACE_FOR_CHAR (f, face, 0);
11042 it->face_id = FACE_FOR_CHARSET (f, it->face_id, CHARSET_ASCII);
11043 } 11000 }
11044 11001
11045 if (FRAME_WINDOW_P (f)) 11002 if (FRAME_WINDOW_P (f))
@@ -11140,8 +11097,7 @@ highlight_trailing_whitespace (f, row)
11140 && glyph->u.ch == ' ')) 11097 && glyph->u.ch == ' '))
11141 && trailing_whitespace_p (glyph->charpos)) 11098 && trailing_whitespace_p (glyph->charpos))
11142 { 11099 {
11143 int face_id = lookup_named_face (f, Qtrailing_whitespace, 11100 int face_id = lookup_named_face (f, Qtrailing_whitespace, 0);
11144 CHARSET_ASCII);
11145 11101
11146 while (glyph >= start 11102 while (glyph >= start
11147 && BUFFERP (glyph->object) 11103 && BUFFERP (glyph->object)