Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 49a24b4fd526 |
children | 859a2309aef8 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
54 #include "objects.h" | 54 #include "objects.h" |
55 #include "process.h" | 55 #include "process.h" |
56 #include "redisplay.h" | 56 #include "redisplay.h" |
57 #include "toolbar.h" | 57 #include "toolbar.h" |
58 #include "window.h" | 58 #include "window.h" |
59 | |
59 | 60 |
60 /* Note: We have to be careful throughout this code to properly handle | 61 /* Note: We have to be careful throughout this code to properly handle |
61 and differentiate between Bufbytes and Emchars. | 62 and differentiate between Bufbytes and Emchars. |
62 | 63 |
63 Since strings are generally composed of Bufbytes, I've taken the tack | 64 Since strings are generally composed of Bufbytes, I've taken the tack |
508 rtw_emchar_dynarr = Dynarr_new (Emchar); | 509 rtw_emchar_dynarr = Dynarr_new (Emchar); |
509 Dynarr_reset (rtw_emchar_dynarr); | 510 Dynarr_reset (rtw_emchar_dynarr); |
510 | 511 |
511 fixup_internal_substring (nonreloc, reloc, offset, &len); | 512 fixup_internal_substring (nonreloc, reloc, offset, &len); |
512 if (STRINGP (reloc)) | 513 if (STRINGP (reloc)) |
513 nonreloc = string_data (XSTRING (reloc)); | 514 nonreloc = XSTRING_DATA (reloc); |
514 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); | 515 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); |
515 return redisplay_text_width_emchar_string | 516 return redisplay_text_width_emchar_string |
516 (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0), | 517 (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0), |
517 Dynarr_length (rtw_emchar_dynarr)); | 518 Dynarr_length (rtw_emchar_dynarr)); |
518 } | 519 } |
530 rtw_emchar_dynarr = Dynarr_new (Emchar); | 531 rtw_emchar_dynarr = Dynarr_new (Emchar); |
531 Dynarr_reset (rtw_emchar_dynarr); | 532 Dynarr_reset (rtw_emchar_dynarr); |
532 | 533 |
533 fixup_internal_substring (nonreloc, reloc, offset, &len); | 534 fixup_internal_substring (nonreloc, reloc, offset, &len); |
534 if (STRINGP (reloc)) | 535 if (STRINGP (reloc)) |
535 nonreloc = string_data (XSTRING (reloc)); | 536 nonreloc = XSTRING_DATA (reloc); |
536 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); | 537 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); |
537 find_charsets_in_bufbyte_string (charsets, nonreloc, len); | 538 find_charsets_in_bufbyte_string (charsets, nonreloc, len); |
538 reset_face_cachel (&cachel); | 539 reset_face_cachel (&cachel); |
539 cachel.face = face; | 540 cachel.face = face; |
540 XSETFRAME (frame, f); | 541 XSETFRAME (frame, f); |
870 data->last_char_width = fi->width; | 871 data->last_char_width = fi->width; |
871 else | 872 else |
872 data->last_char_width = -1; | 873 data->last_char_width = -1; |
873 data->new_ascent = max (data->new_ascent, (int) fi->ascent); | 874 data->new_ascent = max (data->new_ascent, (int) fi->ascent); |
874 data->new_descent = max (data->new_descent, (int) fi->descent); | 875 data->new_descent = max (data->new_descent, (int) fi->descent); |
876 /* The following line causes display goobers and I don't know why */ | |
877 /*data->last_charset = charset;*/ | |
875 } | 878 } |
876 | 879 |
877 width = data->last_char_width; | 880 width = data->last_char_width; |
878 if (width < 0) | 881 if (width < 0) |
879 { | 882 { |
1266 else if (STRINGP (de->contents[elt])) | 1269 else if (STRINGP (de->contents[elt])) |
1267 { | 1270 { |
1268 prop = | 1271 prop = |
1269 add_bufbyte_string_runes | 1272 add_bufbyte_string_runes |
1270 (data, | 1273 (data, |
1271 string_data (XSTRING (de->contents[elt])), | 1274 XSTRING_DATA (de->contents[elt]), |
1272 string_length (XSTRING (de->contents[elt])), | 1275 XSTRING_LENGTH (de->contents[elt]), |
1273 0); | 1276 0); |
1274 } | 1277 } |
1275 else if (GLYPHP (de->contents[elt])) | 1278 else if (GLYPHP (de->contents[elt])) |
1276 { | 1279 { |
1277 if (data->start_col) | 1280 if (data->start_col) |
1305 } | 1308 } |
1306 } | 1309 } |
1307 else if (STRINGP (entry)) | 1310 else if (STRINGP (entry)) |
1308 { | 1311 { |
1309 prop = add_bufbyte_string_runes (data, | 1312 prop = add_bufbyte_string_runes (data, |
1310 string_data (XSTRING (entry)), | 1313 XSTRING_DATA (entry), |
1311 string_length (XSTRING (entry)), | 1314 XSTRING_LENGTH (entry), |
1312 0); | 1315 0); |
1313 } | 1316 } |
1314 else if (GLYPHP (entry)) | 1317 else if (GLYPHP (entry)) |
1315 { | 1318 { |
1316 if (data->start_col) | 1319 if (data->start_col) |
2643 | 2646 |
2644 if (STRINGP (Voverlay_arrow_string)) | 2647 if (STRINGP (Voverlay_arrow_string)) |
2645 { | 2648 { |
2646 add_bufbyte_string_runes | 2649 add_bufbyte_string_runes |
2647 (&data, | 2650 (&data, |
2648 string_data (XSTRING (Voverlay_arrow_string)), | 2651 XSTRING_DATA (Voverlay_arrow_string), |
2649 string_length (XSTRING (Voverlay_arrow_string)), | 2652 XSTRING_LENGTH (Voverlay_arrow_string), |
2650 1); | 2653 1); |
2651 } | 2654 } |
2652 else if (GLYPHP (Voverlay_arrow_string)) | 2655 else if (GLYPHP (Voverlay_arrow_string)) |
2653 { | 2656 { |
2654 struct glyph_block gb; | 2657 struct glyph_block gb; |
3606 Bufbyte *strdata; | 3609 Bufbyte *strdata; |
3607 struct buffer *buf = XBUFFER (WINDOW_BUFFER (w)); | 3610 struct buffer *buf = XBUFFER (WINDOW_BUFFER (w)); |
3608 | 3611 |
3609 detach_all_extents (result_str); | 3612 detach_all_extents (result_str); |
3610 resize_string (XSTRING (result_str), -1, | 3613 resize_string (XSTRING (result_str), -1, |
3611 data.bytepos - string_length (XSTRING (result_str))); | 3614 data.bytepos - XSTRING_LENGTH (result_str)); |
3612 | 3615 |
3613 strdata = string_data (XSTRING (result_str)); | 3616 strdata = XSTRING_DATA (result_str); |
3614 | 3617 |
3615 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) | 3618 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) |
3616 { | 3619 { |
3617 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) | 3620 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) |
3618 { | 3621 { |
3752 if (STRINGP (elt)) | 3755 if (STRINGP (elt)) |
3753 { | 3756 { |
3754 /* A string. Add to the display line and check for %-constructs | 3757 /* A string. Add to the display line and check for %-constructs |
3755 within it. */ | 3758 within it. */ |
3756 | 3759 |
3757 Bufbyte *this = string_data (XSTRING (elt)); | 3760 Bufbyte *this = XSTRING_DATA (elt); |
3758 | 3761 |
3759 while ((pos < max_pos || max_pos == -1) && *this) | 3762 while ((pos < max_pos || max_pos == -1) && *this) |
3760 { | 3763 { |
3761 Bufbyte *last = this; | 3764 Bufbyte *last = this; |
3762 | 3765 |
3863 don't check for % within it. */ | 3866 don't check for % within it. */ |
3864 if (STRINGP (tem)) | 3867 if (STRINGP (tem)) |
3865 { | 3868 { |
3866 pos = | 3869 pos = |
3867 add_string_to_fstring_db_runes | 3870 add_string_to_fstring_db_runes |
3868 (data, string_data (XSTRING (tem)), pos, min_pos, max_pos); | 3871 (data, XSTRING_DATA (tem), pos, min_pos, max_pos); |
3869 } | 3872 } |
3870 /* Give up right away for nil or t. */ | 3873 /* Give up right away for nil or t. */ |
3871 else if (!EQ (tem, elt)) | 3874 else if (!EQ (tem, elt)) |
3872 { | 3875 { |
3873 elt = tem; | 3876 elt = tem; |
4226 { | 4229 { |
4227 struct prop_block pb; | 4230 struct prop_block pb; |
4228 prop = Dynarr_new (struct prop_block); | 4231 prop = Dynarr_new (struct prop_block); |
4229 | 4232 |
4230 pb.type = PROP_MINIBUF_PROMPT; | 4233 pb.type = PROP_MINIBUF_PROMPT; |
4231 pb.data.p_string.str = string_data (XSTRING (Vminibuf_prompt)); | 4234 pb.data.p_string.str = XSTRING_DATA (Vminibuf_prompt); |
4232 pb.data.p_string.len = string_length (XSTRING (Vminibuf_prompt)); | 4235 pb.data.p_string.len = XSTRING_LENGTH (Vminibuf_prompt); |
4233 Dynarr_add (prop, pb); | 4236 Dynarr_add (prop, pb); |
4234 } | 4237 } |
4235 else | 4238 else |
4236 prop = 0; | 4239 prop = 0; |
4237 | 4240 |
5718 (CONST Bufbyte *) buf, strlen (buf)); | 5721 (CONST Bufbyte *) buf, strlen (buf)); |
5719 | 5722 |
5720 goto decode_mode_spec_done; | 5723 goto decode_mode_spec_done; |
5721 } | 5724 } |
5722 | 5725 |
5726 | |
5723 /* print the current line number */ | 5727 /* print the current line number */ |
5724 case 'l': | 5728 case 'l': |
5725 str = window_line_number (w, type); | 5729 str = window_line_number (w, type); |
5726 break; | 5730 break; |
5727 | 5731 |
5833 Bufpos toppos = marker_position (w->start[type]); | 5837 Bufpos toppos = marker_position (w->start[type]); |
5834 Bufpos botpos = BUF_Z (b) - w->window_end_pos[type]; | 5838 Bufpos botpos = BUF_Z (b) - w->window_end_pos[type]; |
5835 Charcount total = BUF_ZV (b) - BUF_BEGV (b); | 5839 Charcount total = BUF_ZV (b) - BUF_BEGV (b); |
5836 | 5840 |
5837 /* botpos is only accurate as of the last redisplay, so we can | 5841 /* botpos is only accurate as of the last redisplay, so we can |
5838 only treat it as a hint. In particular, after erase-buffer, | 5842 only treat it as a hint. In particular, after erase-buffer, |
5839 botpos may be negative. */ | 5843 botpos may be negative. */ |
5840 if (botpos < toppos) | 5844 if (botpos < toppos) |
5841 botpos = toppos; | 5845 botpos = toppos; |
5842 | 5846 |
5843 if (botpos >= BUF_ZV (b)) | 5847 if (botpos >= BUF_ZV (b)) |
5844 { | 5848 { |
5845 if (toppos <= BUF_BEGV (b)) | 5849 if (toppos <= BUF_BEGV (b)) |
5846 str = "All"; | 5850 str = "All"; |
5847 else | 5851 else |
5917 break; | 5921 break; |
5918 | 5922 |
5919 } | 5923 } |
5920 | 5924 |
5921 if (STRINGP (obj)) | 5925 if (STRINGP (obj)) |
5922 Dynarr_add_many (mode_spec_bufbyte_string, string_data (XSTRING (obj)), | 5926 Dynarr_add_many (mode_spec_bufbyte_string, |
5923 string_length (XSTRING (obj))); | 5927 XSTRING_DATA (obj), |
5928 XSTRING_LENGTH (obj)); | |
5924 else if (str) | 5929 else if (str) |
5925 Dynarr_add_many (mode_spec_bufbyte_string, (Bufbyte *) str, strlen (str)); | 5930 Dynarr_add_many (mode_spec_bufbyte_string, (Bufbyte *) str, strlen (str)); |
5926 | 5931 |
5927 decode_mode_spec_done: | 5932 decode_mode_spec_done: |
5928 Dynarr_add (mode_spec_bufbyte_string, '\0'); | 5933 Dynarr_add (mode_spec_bufbyte_string, '\0'); |
5929 } | 5934 } |
5930 | 5935 |
5931 /* Given a display line, free all if its data structures. */ | 5936 /* Given a display line, free all of its data structures. */ |
5932 | 5937 |
5933 static void | 5938 static void |
5934 free_display_line (struct display_line *dl) | 5939 free_display_line (struct display_line *dl) |
5935 { | 5940 { |
5936 int block; | 5941 int block; |