comparison src/redisplay.c @ 183:e121b013d1f0 r20-3b18

Import from CVS: tag r20-3b18
author cvs
date Mon, 13 Aug 2007 09:54:23 +0200
parents 9ad43877534d
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
182:f07455f06202 183:e121b013d1f0
113 only have to do some things when 113 only have to do some things when
114 the charset changes. */ 114 the charset changes. */
115 face_index last_findex; /* The face index of the previous character. 115 face_index last_findex; /* The face index of the previous character.
116 Needed to ensure the validity of the 116 Needed to ensure the validity of the
117 last_charset optimization. */ 117 last_charset optimization. */
118 118
119 int last_char_width; /* The width of the previous character. */ 119 int last_char_width; /* The width of the previous character. */
120 int font_is_bogus; /* If true, it means we couldn't instantiate 120 int font_is_bogus; /* If true, it means we couldn't instantiate
121 the font for this charset, so we substitute 121 the font for this charset, so we substitute
122 ~'s from the ASCII charset. */ 122 ~'s from the ASCII charset. */
123 Bytind bi_bufpos; 123 Bytind bi_bufpos;
193 */ 193 */
194 194
195 struct prop_block 195 struct prop_block
196 { 196 {
197 enum prop_type type; 197 enum prop_type type;
198 198
199 union data 199 union data
200 { 200 {
201 struct 201 struct
202 { 202 {
203 Bufbyte *str; 203 Bufbyte *str;
204 Bytecount len; /* length of the string. */ 204 Bytecount len; /* length of the string. */
205 } p_string; 205 } p_string;
206 206
207 struct 207 struct
208 { 208 {
209 Emchar ch; 209 Emchar ch;
210 Bytind bi_cursor_bufpos; /* NOTE: is in Bytinds */ 210 Bytind bi_cursor_bufpos; /* NOTE: is in Bytinds */
211 unsigned int cursor_type :3; 211 unsigned int cursor_type :3;
212 } p_char; 212 } p_char;
213 213
214 struct 214 struct
215 { 215 {
216 int width; 216 int width;
217 face_index findex; 217 face_index findex;
218 } p_blank; 218 } p_blank;
392 int faces_changed; 392 int faces_changed;
393 393
394 /* Nonzero means some frames have been marked as garbaged */ 394 /* Nonzero means some frames have been marked as garbaged */
395 int frame_changed; 395 int frame_changed;
396 396
397 /* This variable is 1 if the icon has to be updated. 397 /* This variable is 1 if the icon has to be updated.
398 It is set to 1 when `frame-icon-glyph' changes. */ 398 It is set to 1 when `frame-icon-glyph' changes. */
399 int icon_changed; 399 int icon_changed;
400 int icon_changed_set; 400 int icon_changed_set;
401 401
402 /* This variable is 1 if the menubar widget has to be updated. 402 /* This variable is 1 if the menubar widget has to be updated.
403 It is set to 1 by set-menubar-dirty-flag and cleared when the widget 403 It is set to 1 by set-menubar-dirty-flag and cleared when the widget
404 has been indapted. */ 404 has been indapted. */
405 /* indapted???? */ 405 /* indapted???? */
406 int menubar_changed; 406 int menubar_changed;
407 int menubar_changed_set; 407 int menubar_changed_set;
472 #ifndef INHIBIT_REDISPLAY_HOOKS 472 #ifndef INHIBIT_REDISPLAY_HOOKS
473 /* #### Chuck says: I think this needs more thought. 473 /* #### Chuck says: I think this needs more thought.
474 Think about this for 19.14. */ 474 Think about this for 19.14. */
475 Lisp_Object Vpre_redisplay_hook, Vpost_redisplay_hook; 475 Lisp_Object Vpre_redisplay_hook, Vpost_redisplay_hook;
476 Lisp_Object Qpre_redisplay_hook, Qpost_redisplay_hook; 476 Lisp_Object Qpre_redisplay_hook, Qpost_redisplay_hook;
477 #endif 477 #endif /* INHIBIT_REDISPLAY_HOOKS */
478 478
479 int last_display_warning_tick, display_warning_tick; 479 int last_display_warning_tick, display_warning_tick;
480 Lisp_Object Qdisplay_warning_buffer; 480 Lisp_Object Qdisplay_warning_buffer;
481 int inhibit_warning_display; 481 int inhibit_warning_display;
482 482
517 Bytecount offset, Bytecount len) 517 Bytecount offset, Bytecount len)
518 { 518 {
519 if (!rtw_emchar_dynarr) 519 if (!rtw_emchar_dynarr)
520 rtw_emchar_dynarr = Dynarr_new (Emchar); 520 rtw_emchar_dynarr = Dynarr_new (Emchar);
521 Dynarr_reset (rtw_emchar_dynarr); 521 Dynarr_reset (rtw_emchar_dynarr);
522 522
523 fixup_internal_substring (nonreloc, reloc, offset, &len); 523 fixup_internal_substring (nonreloc, reloc, offset, &len);
524 if (STRINGP (reloc)) 524 if (STRINGP (reloc))
525 nonreloc = XSTRING_DATA (reloc); 525 nonreloc = XSTRING_DATA (reloc);
526 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); 526 convert_bufbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr);
527 return redisplay_text_width_emchar_string 527 return redisplay_text_width_emchar_string
861 if (!EQ (charset, data->last_charset) || 861 if (!EQ (charset, data->last_charset) ||
862 data->findex != data->last_findex) 862 data->findex != data->last_findex)
863 { 863 {
864 /* OK, we need to do things the hard way. */ 864 /* OK, we need to do things the hard way. */
865 struct window *w = XWINDOW (data->window); 865 struct window *w = XWINDOW (data->window);
866 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); 866 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex);
867 Lisp_Object font_instance = 867 Lisp_Object font_instance =
868 ensure_face_cachel_contains_charset (cachel, data->window, 868 ensure_face_cachel_contains_charset (cachel, data->window,
869 charset); 869 charset);
870 struct Lisp_Font_Instance *fi; 870 struct Lisp_Font_Instance *fi;
871 871
979 /* #### This function is too simplistic. It needs to do the same 979 /* #### This function is too simplistic. It needs to do the same
980 sort of character interpretation (display-table lookup, 980 sort of character interpretation (display-table lookup,
981 ctl-arrow checking), etc. that create_text_block() does. 981 ctl-arrow checking), etc. that create_text_block() does.
982 The functionality to do this in that routine needs to be 982 The functionality to do this in that routine needs to be
983 modularized. */ 983 modularized. */
984 984
985 for (pos = c_string; pos < end;) 985 for (pos = c_string; pos < end;)
986 { 986 {
987 data->ch = charptr_emchar (pos); 987 data->ch = charptr_emchar (pos);
988 988
989 prop = add_emchar_rune (data); 989 prop = add_emchar_rune (data);
1047 if (spcwid >= data->blank_width) 1047 if (spcwid >= data->blank_width)
1048 data->blank_width = 0; 1048 data->blank_width = 0;
1049 else 1049 else
1050 data->blank_width -= spcwid; 1050 data->blank_width -= spcwid;
1051 } 1051 }
1052 1052
1053 data->start_col = 0; 1053 data->start_col = 0;
1054 retval = add_hscroll_rune (data); 1054 retval = add_hscroll_rune (data);
1055 1055
1056 /* Could be caused by the handling of the hscroll rune. */ 1056 /* Could be caused by the handling of the hscroll rune. */
1057 if (retval != NULL || !data->blank_width) 1057 if (retval != NULL || !data->blank_width)
1486 abort (); 1486 abort ();
1487 } 1487 }
1488 } 1488 }
1489 1489
1490 oops_no_more_space: 1490 oops_no_more_space:
1491 1491
1492 data->bi_cursor_bufpos = bi_old_cursor_bufpos; 1492 data->bi_cursor_bufpos = bi_old_cursor_bufpos;
1493 data->cursor_type = old_cursor_type; 1493 data->cursor_type = old_cursor_type;
1494 if (elt < Dynarr_length (*prop)) 1494 if (elt < Dynarr_length (*prop))
1495 { 1495 {
1496 Dynarr_delete_many (*prop, 0, elt); 1496 Dynarr_delete_many (*prop, 0, elt);
1867 displayed. */ 1867 displayed. */
1868 int no_more_frags = 0; 1868 int no_more_frags = 0;
1869 1869
1870 Lisp_Object synch_minibuffers_value = 1870 Lisp_Object synch_minibuffers_value =
1871 symbol_value_in_buffer (Qsynchronize_minibuffers, w->buffer); 1871 symbol_value_in_buffer (Qsynchronize_minibuffers, w->buffer);
1872 1872
1873 dl->used_prop_data = 0; 1873 dl->used_prop_data = 0;
1874 dl->num_chars = 0; 1874 dl->num_chars = 0;
1875 1875
1876 memset (&data, 0, sizeof (data)); 1876 memset (&data, 0, sizeof (data));
1877 data.ef = extent_fragment_new (w->buffer, f); 1877 data.ef = extent_fragment_new (w->buffer, f);
2078 else if (data.bi_bufpos == BI_BUF_ZV (b)) 2078 else if (data.bi_bufpos == BI_BUF_ZV (b))
2079 goto done; 2079 goto done;
2080 else if (data.bi_bufpos < BI_BUF_BEGV (b)) 2080 else if (data.bi_bufpos < BI_BUF_BEGV (b))
2081 /* #### urk urk urk! Aborts are not very fun! Fix this please! */ 2081 /* #### urk urk urk! Aborts are not very fun! Fix this please! */
2082 data.bi_bufpos = BI_BUF_BEGV (b); 2082 data.bi_bufpos = BI_BUF_BEGV (b);
2083 else 2083 else
2084 INC_BYTIND (b, data.bi_bufpos); 2084 INC_BYTIND (b, data.bi_bufpos);
2085 } 2085 }
2086 2086
2087 /* If there are end glyphs, add them to the line. These are 2087 /* If there are end glyphs, add them to the line. These are
2088 the end glyphs for the previous run of text. We add them 2088 the end glyphs for the previous run of text. We add them
2435 make it appear on the truncation glyph. If we've hit 2435 make it appear on the truncation glyph. If we've hit
2436 the end of the buffer then we also make the cursor 2436 the end of the buffer then we also make the cursor
2437 appear unless eob is immediately preceded by a 2437 appear unless eob is immediately preceded by a
2438 newline. In that case the cursor should actually 2438 newline. In that case the cursor should actually
2439 appear on the next line. */ 2439 appear on the next line. */
2440 if (data.cursor_type == CURSOR_ON 2440 if (data.cursor_type == CURSOR_ON
2441 && data.bi_cursor_bufpos >= data.bi_bufpos 2441 && data.bi_cursor_bufpos >= data.bi_bufpos
2442 && (data.bi_cursor_bufpos < bi_pos || 2442 && (data.bi_cursor_bufpos < bi_pos ||
2443 (bi_pos == BI_BUF_ZV (b) 2443 (bi_pos == BI_BUF_ZV (b)
2444 && (bi_pos == BI_BUF_BEGV (b) 2444 && (bi_pos == BI_BUF_BEGV (b)
2445 || (BI_BUF_FETCH_CHAR (b, prev_bytind (b, bi_pos)) 2445 || (BI_BUF_FETCH_CHAR (b, prev_bytind (b, bi_pos))
2486 data.bi_start_col_enabled = 0; 2486 data.bi_start_col_enabled = 0;
2487 2487
2488 data.max_pixpos += data.blank_width; 2488 data.max_pixpos += data.blank_width;
2489 add_emchar_rune (&data); 2489 add_emchar_rune (&data);
2490 data.max_pixpos -= data.blank_width; 2490 data.max_pixpos -= data.blank_width;
2491 2491
2492 /* #### urk! Chuck, this shit is bad news. Going around 2492 /* #### urk! Chuck, this shit is bad news. Going around
2493 manipulating invalid positions is guaranteed to result in 2493 manipulating invalid positions is guaranteed to result in
2494 trouble sooner or later. */ 2494 trouble sooner or later. */
2495 data.bi_bufpos = BI_BUF_ZV (b) + 1; 2495 data.bi_bufpos = BI_BUF_ZV (b) + 1;
2496 } 2496 }
2637 create_overlay_glyph_block (struct window *w, struct display_line *dl) 2637 create_overlay_glyph_block (struct window *w, struct display_line *dl)
2638 { 2638 {
2639 struct frame *f = XFRAME (w->frame); 2639 struct frame *f = XFRAME (w->frame);
2640 struct device *d = XDEVICE (f->device); 2640 struct device *d = XDEVICE (f->device);
2641 pos_data data; 2641 pos_data data;
2642 2642
2643 /* If Voverlay_arrow_string isn't valid then just fail silently. */ 2643 /* If Voverlay_arrow_string isn't valid then just fail silently. */
2644 if (!STRINGP (Voverlay_arrow_string) && !GLYPHP (Voverlay_arrow_string)) 2644 if (!STRINGP (Voverlay_arrow_string) && !GLYPHP (Voverlay_arrow_string))
2645 return 0; 2645 return 0;
2646 2646
2647 memset (&data, 0, sizeof (data)); 2647 memset (&data, 0, sizeof (data));
3053 } 3053 }
3054 3054
3055 elt++; 3055 elt++;
3056 } 3056 }
3057 3057
3058 /* Now that we now where everything goes, we add the glyphs as runes 3058 /* Now that we know where everything goes, we add the glyphs as
3059 to the appropriate display blocks. */ 3059 runes to the appropriate display blocks. */
3060 if (out_cnt || in_out_cnt || white_out_cnt) 3060 if (out_cnt || in_out_cnt || white_out_cnt)
3061 { 3061 {
3062 odb = get_display_block_from_line (dl, LEFT_OUTSIDE_MARGIN); 3062 odb = get_display_block_from_line (dl, LEFT_OUTSIDE_MARGIN);
3063 odb->start_pos = dl->bounds.left_out; 3063 odb->start_pos = dl->bounds.left_out;
3064 /* #### We should stop adding a blank to account for the space 3064 /* #### We should stop adding a blank to account for the space
3761 3761
3762 -- C zero-terminated-string lossage. 3762 -- C zero-terminated-string lossage.
3763 -- Non-printable characters should be converted into something 3763 -- Non-printable characters should be converted into something
3764 appropriate (e.g. ^F) instead of blindly being printed anyway. 3764 appropriate (e.g. ^F) instead of blindly being printed anyway.
3765 */ 3765 */
3766 3766
3767 tail_recurse: 3767 tail_recurse:
3768 if (depth > 10) 3768 if (depth > 10)
3769 goto invalid; 3769 goto invalid;
3770 3770
3771 depth++; 3771 depth++;
3889 (data, XSTRING_DATA (tem), pos, min_pos, max_pos); 3889 (data, XSTRING_DATA (tem), pos, min_pos, max_pos);
3890 } 3890 }
3891 /* Give up right away for nil or t. */ 3891 /* Give up right away for nil or t. */
3892 else if (!EQ (tem, elt)) 3892 else if (!EQ (tem, elt))
3893 { 3893 {
3894 elt = tem; 3894 elt = tem;
3895 goto tail_recurse; 3895 goto tail_recurse;
3896 } 3896 }
3897 } 3897 }
3898 } 3898 }
3899 else if (CONSP (elt)) 3899 else if (CONSP (elt))
3900 { 3900 {
3922 Use its car if CAR has a non-nil value. */ 3922 Use its car if CAR has a non-nil value. */
3923 if (!UNBOUNDP (tem)) 3923 if (!UNBOUNDP (tem))
3924 { 3924 {
3925 if (!NILP (tem)) 3925 if (!NILP (tem))
3926 { 3926 {
3927 elt = XCAR (elt); 3927 elt = XCAR (elt);
3928 goto tail_recurse; 3928 goto tail_recurse;
3929 } 3929 }
3930 } 3930 }
3931 /* Symbol's value is nil (or symbol is unbound) 3931 /* Symbol's value is nil (or symbol is unbound)
3932 * Get the cddr of the original list 3932 * Get the cddr of the original list
4011 new_findex = get_builtin_face_cache_index (w, face); 4011 new_findex = get_builtin_face_cache_index (w, face);
4012 /* !!#### not right; needs to compute the max height of 4012 /* !!#### not right; needs to compute the max height of
4013 all the charsets */ 4013 all the charsets */
4014 font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex, 4014 font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex,
4015 Vcharset_ascii); 4015 Vcharset_ascii);
4016 4016
4017 data->dl->ascent = max (data->dl->ascent, 4017 data->dl->ascent = max (data->dl->ascent,
4018 XFONT_INSTANCE (font_inst)->ascent); 4018 XFONT_INSTANCE (font_inst)->ascent);
4019 data->dl->descent = max (data->dl->descent, 4019 data->dl->descent = max (data->dl->descent,
4020 XFONT_INSTANCE (font_inst)-> 4020 XFONT_INSTANCE (font_inst)->
4021 descent); 4021 descent);
4022 } 4022 }
4023 else 4023 else
4024 new_findex = old_findex; 4024 new_findex = old_findex;
4025 4025
4026 data->findex = new_findex; 4026 data->findex = new_findex;
4027 pos = generate_fstring_runes (w, data, pos, pos, max_pos, 4027 pos = generate_fstring_runes (w, data, pos, pos, max_pos,
4028 XCDR (elt), depth - 1, 4028 XCDR (elt), depth - 1,
4029 max_pixsize, new_findex, type); 4029 max_pixsize, new_findex, type);
4030 data->findex = old_findex; 4030 data->findex = old_findex;
5359 /* Update the menubar. It is done first since it could change 5359 /* Update the menubar. It is done first since it could change
5360 the menubar's visibility. This way we avoid having flashing 5360 the menubar's visibility. This way we avoid having flashing
5361 caused by an Expose event generated by the visibility change 5361 caused by an Expose event generated by the visibility change
5362 being handled. */ 5362 being handled. */
5363 update_frame_menubars (f); 5363 update_frame_menubars (f);
5364 #endif 5364 #endif /* HAVE_MENUBARS */
5365 5365
5366 #ifdef HAVE_TOOLBARS 5366 #ifdef HAVE_TOOLBARS
5367 /* Update the toolbars. */ 5367 /* Update the toolbars. */
5368 update_frame_toolbars (f); 5368 update_frame_toolbars (f);
5369 #endif 5369 #endif /* HAVE_TOOLBARS */
5370 5370
5371 hold_frame_size_changes (); 5371 hold_frame_size_changes ();
5372 5372
5373 /* ----------------- BEGIN CRITICAL REDISPLAY SECTION ---------------- */ 5373 /* ----------------- BEGIN CRITICAL REDISPLAY SECTION ---------------- */
5374 /* Within this section, we are defenseless and assume that the 5374 /* Within this section, we are defenseless and assume that the
5469 if (preempted) 5469 if (preempted)
5470 return 1; 5470 return 1;
5471 5471
5472 /* Always do the selected frame first. */ 5472 /* Always do the selected frame first. */
5473 frame = DEVICE_SELECTED_FRAME (d); 5473 frame = DEVICE_SELECTED_FRAME (d);
5474 5474
5475 f = XFRAME (frame); 5475 f = XFRAME (frame);
5476 5476
5477 if (f->icon_changed || f->windows_changed) 5477 if (f->icon_changed || f->windows_changed)
5478 update_frame_icon (f); 5478 update_frame_icon (f);
5479 5479
5556 restore_profiling_redisplay_flag (Lisp_Object val) 5556 restore_profiling_redisplay_flag (Lisp_Object val)
5557 { 5557 {
5558 profiling_redisplay_flag = XINT (val); 5558 profiling_redisplay_flag = XINT (val);
5559 return Qnil; 5559 return Qnil;
5560 } 5560 }
5561 #endif 5561 #endif /* WINDOWSNT */
5562 5562
5563 /* Ensure that all windows on all frames on all devices are displaying 5563 /* Ensure that all windows on all frames on all devices are displaying
5564 the current contents of their respective buffers. */ 5564 the current contents of their respective buffers. */
5565 5565
5566 static void 5566 static void
5575 { 5575 {
5576 record_unwind_protect (restore_profiling_redisplay_flag, 5576 record_unwind_protect (restore_profiling_redisplay_flag,
5577 make_int (profiling_redisplay_flag)); 5577 make_int (profiling_redisplay_flag));
5578 profiling_redisplay_flag = 1; 5578 profiling_redisplay_flag = 1;
5579 } 5579 }
5580 #endif 5580 #endif /* WINDOWSNT */
5581 5581
5582 if (asynch_device_change_pending) 5582 if (asynch_device_change_pending)
5583 handle_asynch_device_change (); 5583 handle_asynch_device_change ();
5584 5584
5585 if (!buffers_changed && !clip_changed && !extents_changed && !faces_changed 5585 if (!buffers_changed && !clip_changed && !extents_changed && !faces_changed
5664 C code that call redisplay() are prepared to handle GCing, 5664 C code that call redisplay() are prepared to handle GCing,
5665 so we should be OK. */ 5665 so we should be OK. */
5666 #ifndef INHIBIT_REDISPLAY_HOOKS 5666 #ifndef INHIBIT_REDISPLAY_HOOKS
5667 run_hook_trapping_errors ("Error in pre-redisplay-hook", 5667 run_hook_trapping_errors ("Error in pre-redisplay-hook",
5668 Qpre_redisplay_hook); 5668 Qpre_redisplay_hook);
5669 #endif 5669 #endif /* INHIBIT_REDISPLAY_HOOKS */
5670 5670
5671 redisplay_without_hooks (); 5671 redisplay_without_hooks ();
5672 5672
5673 #ifndef INHIBIT_REDISPLAY_HOOKS 5673 #ifndef INHIBIT_REDISPLAY_HOOKS
5674 run_hook_trapping_errors ("Error in post-redisplay-hook", 5674 run_hook_trapping_errors ("Error in post-redisplay-hook",
5675 Qpost_redisplay_hook); 5675 Qpost_redisplay_hook);
5676 #endif 5676 #endif /* INHIBIT_REDISPLAY_HOOKS */
5677 } 5677 }
5678 5678
5679 /* Inefficiently determine the line number of the line point is on and 5679 /* Inefficiently determine the line number of the line point is on and
5680 return it as a string. Always do this regardless of whether 5680 return it as a string. Always do this regardless of whether
5681 line_number_mode is true. */ 5681 line_number_mode is true. */
5768 if (CODING_SYSTEMP (codesys)) 5768 if (CODING_SYSTEMP (codesys))
5769 obj = Fcoding_system_property (codesys, Qmnemonic); 5769 obj = Fcoding_system_property (codesys, Qmnemonic);
5770 } 5770 }
5771 } 5771 }
5772 break; 5772 break;
5773 #endif 5773 #endif /* MULE */
5774 5774
5775 /* print the current line number */ 5775 /* print the current line number */
5776 case 'l': 5776 case 'l':
5777 str = window_line_number (w, type); 5777 str = window_line_number (w, type);
5778 break; 5778 break;
5791 { 5791 {
5792 str = alloca (10); 5792 str = alloca (10);
5793 sprintf (str, "-%d", f->order_count); 5793 sprintf (str, "-%d", f->order_count);
5794 } 5794 }
5795 } 5795 }
5796 #endif 5796 #endif /* HAVE_TTY */
5797 break; 5797 break;
5798 5798
5799 /* print Narrow if appropriate */ 5799 /* print Narrow if appropriate */
5800 case 'n': 5800 case 'n':
5801 if (BUF_BEGV (b) > BUF_BEG (b) 5801 if (BUF_BEGV (b) > BUF_BEG (b)
5903 /* botpos is only accurate as of the last redisplay, so we can 5903 /* botpos is only accurate as of the last redisplay, so we can
5904 only treat it as a hint. In particular, after erase-buffer, 5904 only treat it as a hint. In particular, after erase-buffer,
5905 botpos may be negative. */ 5905 botpos may be negative. */
5906 if (botpos < toppos) 5906 if (botpos < toppos)
5907 botpos = toppos; 5907 botpos = toppos;
5908 5908
5909 if (botpos >= BUF_ZV (b)) 5909 if (botpos >= BUF_ZV (b))
5910 { 5910 {
5911 if (toppos <= BUF_BEGV (b)) 5911 if (toppos <= BUF_BEGV (b))
5912 str = "All"; 5912 str = "All";
5913 else 5913 else
6715 { 6715 {
6716 w->line_cache_validation_override--; 6716 w->line_cache_validation_override--;
6717 if (-pixheight > point_line_height) 6717 if (-pixheight > point_line_height)
6718 /* We can't make the target line cover pixpos, so put it 6718 /* We can't make the target line cover pixpos, so put it
6719 above pixpos. That way it will at least be visible. */ 6719 above pixpos. That way it will at least be visible. */
6720 return prev_pos; 6720 return prev_pos;
6721 else 6721 else
6722 return cur_pos; 6722 return cur_pos;
6723 } 6723 }
6724 6724
6725 cur_elt--; 6725 cur_elt--;
6784 int pixpos = WINDOW_TEXT_BOTTOM (w); 6784 int pixpos = WINDOW_TEXT_BOTTOM (w);
6785 Bufpos retval, search_point; 6785 Bufpos retval, search_point;
6786 6786
6787 /* If scroll_on_clipped_lines is false, the last "visible" line of 6787 /* If scroll_on_clipped_lines is false, the last "visible" line of
6788 the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1. 6788 the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1.
6789 If s_o_c_l is true, then we don't want to count a clipped 6789 If s_o_c_l is true, then we don't want to count a clipped
6790 line, so back up from the bottom by the height of the line 6790 line, so back up from the bottom by the height of the line
6791 containing point. */ 6791 containing point. */
6792 if (scroll_on_clipped_lines) 6792 if (scroll_on_clipped_lines)
6793 pixpos -= Dynarr_atp (w->line_start_cache, cur_elt)->height; 6793 pixpos -= Dynarr_atp (w->line_start_cache, cur_elt)->height;
6794 else 6794 else
6795 pixpos -= 1; 6795 pixpos -= 1;
7473 *obj1 = toolbar_button_at_pixpos (f, x_coord, y_coord); 7473 *obj1 = toolbar_button_at_pixpos (f, x_coord, y_coord);
7474 *obj2 = Qnil; 7474 *obj2 = Qnil;
7475 *w = 0; 7475 *w = 0;
7476 UPDATE_CACHE_RETURN; 7476 UPDATE_CACHE_RETURN;
7477 } 7477 }
7478 #endif 7478 #endif /* HAVE_TOOLBARS */
7479 7479
7480 /* We still have to return the window the pointer is next to and its 7480 /* We still have to return the window the pointer is next to and its
7481 relative y position even if it is outside the x boundary. */ 7481 relative y position even if it is outside the x boundary. */
7482 if (x_coord < frm_left) 7482 if (x_coord < frm_left)
7483 x_coord = frm_left; 7483 x_coord = frm_left;
7574 Dynarr_atp (db->runes, 7574 Dynarr_atp (db->runes,
7575 Dynarr_length (db->runes) - 1)->bufpos; 7575 Dynarr_length (db->runes) - 1)->bufpos;
7576 else 7576 else
7577 *closest = 7577 *closest =
7578 Dynarr_atp (db->runes, 7578 Dynarr_atp (db->runes,
7579 Dynarr_length (db->runes) - 2)->bufpos; 7579 Dynarr_length (db->runes) - 1)->bufpos;
7580 } 7580 }
7581 7581
7582 if (dl->modeline) 7582 if (dl->modeline)
7583 *modeline_closest += dl->offset; 7583 *modeline_closest += dl->offset;
7584 else 7584 else
7666 if (dl->modeline) 7666 if (dl->modeline)
7667 *modeline_closest = dl->end_bufpos + dl->offset; 7667 *modeline_closest = dl->end_bufpos + dl->offset;
7668 else 7668 else
7669 *closest = dl->end_bufpos + dl->offset; 7669 *closest = dl->end_bufpos + dl->offset;
7670 really_over_nothing = 1; 7670 really_over_nothing = 1;
7671 } 7671 }
7672 } 7672 }
7673 else 7673 else
7674 { 7674 {
7675 if (dl->modeline) 7675 if (dl->modeline)
7676 *modeline_closest = rb->bufpos + dl->offset; 7676 *modeline_closest = rb->bufpos + dl->offset;
8011 /***************************************************************************/ 8011 /***************************************************************************/
8012 8012
8013 static int 8013 static int
8014 compute_rune_dynarr_usage (rune_dynarr *dyn, struct overhead_stats *ovstats) 8014 compute_rune_dynarr_usage (rune_dynarr *dyn, struct overhead_stats *ovstats)
8015 { 8015 {
8016 int total = 0; 8016 return dyn ? Dynarr_memory_usage (dyn, ovstats) : 0;
8017
8018 if (dyn)
8019 total += Dynarr_memory_usage (dyn, ovstats);
8020
8021 return total;
8022 } 8017 }
8023 8018
8024 static int 8019 static int
8025 compute_display_block_dynarr_usage (display_block_dynarr *dyn, 8020 compute_display_block_dynarr_usage (display_block_dynarr *dyn,
8026 struct overhead_stats *ovstats) 8021 struct overhead_stats *ovstats)
8027 { 8022 {
8028 int total = 0; 8023 int total, i;
8029 8024
8030 if (dyn) 8025 if (!dyn)
8031 { 8026 return 0;
8032 int i; 8027
8033 8028 total = Dynarr_memory_usage (dyn, ovstats);
8034 total += Dynarr_memory_usage (dyn, ovstats); 8029 for (i = 0; i < Dynarr_largest (dyn); i++)
8035 for (i = 0; i < Dynarr_largest (dyn); i++) 8030 total += compute_rune_dynarr_usage (Dynarr_at (dyn, i).runes, ovstats);
8036 total += compute_rune_dynarr_usage (Dynarr_at (dyn, i).runes, ovstats);
8037 }
8038 8031
8039 return total; 8032 return total;
8040 } 8033 }
8041 8034
8042 static int 8035 static int
8043 compute_glyph_block_dynarr_usage (glyph_block_dynarr *dyn, 8036 compute_glyph_block_dynarr_usage (glyph_block_dynarr *dyn,
8044 struct overhead_stats *ovstats) 8037 struct overhead_stats *ovstats)
8045 { 8038 {
8046 int total = 0; 8039 return dyn ? Dynarr_memory_usage (dyn, ovstats) : 0;
8047
8048 if (dyn)
8049 total += Dynarr_memory_usage (dyn, ovstats);
8050
8051 return total;
8052 } 8040 }
8053 8041
8054 int 8042 int
8055 compute_display_line_dynarr_usage (display_line_dynarr *dyn, 8043 compute_display_line_dynarr_usage (display_line_dynarr *dyn,
8056 struct overhead_stats *ovstats) 8044 struct overhead_stats *ovstats)
8057 { 8045 {
8058 int total = 0; 8046 int total, i;
8059 8047
8060 if (dyn) 8048 if (!dyn)
8061 { 8049 return 0;
8062 int i; 8050
8063 8051 total = Dynarr_memory_usage (dyn, ovstats);
8064 total += Dynarr_memory_usage (dyn, ovstats); 8052 for (i = 0; i < Dynarr_largest (dyn); i++)
8065 for (i = 0; i < Dynarr_largest (dyn); i++) 8053 {
8066 { 8054 struct display_line *dl = &Dynarr_at (dyn, i);
8067 total += 8055 total += compute_display_block_dynarr_usage(dl->display_blocks, ovstats);
8068 compute_display_block_dynarr_usage (Dynarr_at (dyn, i). 8056 total += compute_glyph_block_dynarr_usage (dl->left_glyphs, ovstats);
8069 display_blocks, ovstats); 8057 total += compute_glyph_block_dynarr_usage (dl->right_glyphs, ovstats);
8070 total +=
8071 compute_glyph_block_dynarr_usage (Dynarr_at (dyn, i).
8072 left_glyphs, ovstats);
8073 total +=
8074 compute_glyph_block_dynarr_usage (Dynarr_at (dyn, i).
8075 right_glyphs, ovstats);
8076 }
8077 } 8058 }
8078 8059
8079 return total; 8060 return total;
8080 } 8061 }
8081 8062
8082 int 8063 int
8083 compute_line_start_cache_dynarr_usage (line_start_cache_dynarr *dyn, 8064 compute_line_start_cache_dynarr_usage (line_start_cache_dynarr *dyn,
8084 struct overhead_stats *ovstats) 8065 struct overhead_stats *ovstats)
8085 { 8066 {
8086 int total = 0; 8067 return dyn ? Dynarr_memory_usage (dyn, ovstats) : 0;
8087
8088 if (dyn)
8089 total += Dynarr_memory_usage (dyn, ovstats);
8090
8091 return total;
8092 } 8068 }
8093 8069
8094 #endif /* MEMORY_USAGE_STATS */ 8070 #endif /* MEMORY_USAGE_STATS */
8095 8071
8096 8072
8137 /* Some stuff checks this way early. */ 8113 /* Some stuff checks this way early. */
8138 Vwindow_system = Qx; 8114 Vwindow_system = Qx;
8139 Vinitial_window_system = Qx; 8115 Vinitial_window_system = Qx;
8140 return; 8116 return;
8141 } 8117 }
8142 #endif 8118 #endif /* HAVE_X_WINDOWS */
8143 8119
8144 /* If no window system has been specified, try to use the terminal. */ 8120 /* If no window system has been specified, try to use the terminal. */
8145 if (!isatty (0)) 8121 if (!isatty (0))
8146 { 8122 {
8147 stderr_out ("XEmacs: standard input is not a tty\n"); 8123 stderr_out ("XEmacs: standard input is not a tty\n");
8163 { 8139 {
8164 defsymbol (&Qcursor_in_echo_area, "cursor-in-echo-area"); 8140 defsymbol (&Qcursor_in_echo_area, "cursor-in-echo-area");
8165 #ifndef INHIBIT_REDISPLAY_HOOKS 8141 #ifndef INHIBIT_REDISPLAY_HOOKS
8166 defsymbol (&Qpre_redisplay_hook, "pre-redisplay-hook"); 8142 defsymbol (&Qpre_redisplay_hook, "pre-redisplay-hook");
8167 defsymbol (&Qpost_redisplay_hook, "post-redisplay-hook"); 8143 defsymbol (&Qpost_redisplay_hook, "post-redisplay-hook");
8168 #endif 8144 #endif /* INHIBIT_REDISPLAY_HOOKS */
8169 defsymbol (&Qdisplay_warning_buffer, "display-warning-buffer"); 8145 defsymbol (&Qdisplay_warning_buffer, "display-warning-buffer");
8170 defsymbol (&Qbar_cursor, "bar-cursor"); 8146 defsymbol (&Qbar_cursor, "bar-cursor");
8171 defsymbol (&Qwindow_scroll_functions, "window-scroll-functions"); 8147 defsymbol (&Qwindow_scroll_functions, "window-scroll-functions");
8172 defsymbol (&Qredisplay_end_trigger_functions, 8148 defsymbol (&Qredisplay_end_trigger_functions,
8173 "redisplay-end-trigger-functions"); 8149 "redisplay-end-trigger-functions");
8187 #if 0 8163 #if 0
8188 staticpro (&last_arrow_position); 8164 staticpro (&last_arrow_position);
8189 staticpro (&last_arrow_string); 8165 staticpro (&last_arrow_string);
8190 last_arrow_position = Qnil; 8166 last_arrow_position = Qnil;
8191 last_arrow_string = Qnil; 8167 last_arrow_string = Qnil;
8192 #endif 8168 #endif /* 0 */
8193 8169
8194 updating_line_start_cache = 0; 8170 updating_line_start_cache = 0;
8195 8171
8196 /* #### Probably temporary */ 8172 /* #### Probably temporary */
8197 DEFVAR_INT ("redisplay-cache-adjustment", &cache_adjustment /* 8173 DEFVAR_INT ("redisplay-cache-adjustment", &cache_adjustment /*
8303 xxDEFVAR_LISP ("post-redisplay-hook", &Vpost_redisplay_hook /* 8279 xxDEFVAR_LISP ("post-redisplay-hook", &Vpost_redisplay_hook /*
8304 Function or functions to run after every redisplay. 8280 Function or functions to run after every redisplay.
8305 Functions on this hook must be careful to avoid signalling errors! 8281 Functions on this hook must be careful to avoid signalling errors!
8306 */ ); 8282 */ );
8307 Vpost_redisplay_hook = Qnil; 8283 Vpost_redisplay_hook = Qnil;
8308 #endif 8284 #endif /* INHIBIT_REDISPLAY_HOOKS */
8309 8285
8310 DEFVAR_INT ("display-warning-tick", &display_warning_tick /* 8286 DEFVAR_INT ("display-warning-tick", &display_warning_tick /*
8311 Bump this to tell the C code to call `display-warning-buffer' 8287 Bump this to tell the C code to call `display-warning-buffer'
8312 at next redisplay. You should not normally change this; the function 8288 at next redisplay. You should not normally change this; the function
8313 `display-warning' automatically does this at appropriate times. 8289 `display-warning' automatically does this at appropriate times.
8361 DEFVAR_SPECIFIER ("left-margin-width", &Vleft_margin_width /* 8337 DEFVAR_SPECIFIER ("left-margin-width", &Vleft_margin_width /*
8362 *Width of left margin. 8338 *Width of left margin.
8363 This is a specifier; use `set-specifier' to change it. 8339 This is a specifier; use `set-specifier' to change it.
8364 */ ); 8340 */ );
8365 Vleft_margin_width = Fmake_specifier (Qnatnum); 8341 Vleft_margin_width = Fmake_specifier (Qnatnum);
8366 set_specifier_fallback 8342 set_specifier_fallback (Vleft_margin_width, list1 (Fcons (Qnil, Qzero)));
8367 (Vleft_margin_width,
8368 list1 (Fcons (Qnil, Qzero)));
8369 set_specifier_caching (Vleft_margin_width, 8343 set_specifier_caching (Vleft_margin_width,
8370 slot_offset (struct window, left_margin_width), 8344 slot_offset (struct window, left_margin_width),
8371 some_window_value_changed, 8345 some_window_value_changed,
8372 slot_offset (struct frame, left_margin_width), 8346 slot_offset (struct frame, left_margin_width),
8373 margin_width_changed_in_frame); 8347 margin_width_changed_in_frame);
8375 DEFVAR_SPECIFIER ("right-margin-width", &Vright_margin_width /* 8349 DEFVAR_SPECIFIER ("right-margin-width", &Vright_margin_width /*
8376 *Width of right margin. 8350 *Width of right margin.
8377 This is a specifier; use `set-specifier' to change it. 8351 This is a specifier; use `set-specifier' to change it.
8378 */ ); 8352 */ );
8379 Vright_margin_width = Fmake_specifier (Qnatnum); 8353 Vright_margin_width = Fmake_specifier (Qnatnum);
8380 set_specifier_fallback 8354 set_specifier_fallback (Vright_margin_width, list1 (Fcons (Qnil, Qzero)));
8381 (Vright_margin_width,
8382 list1 (Fcons (Qnil, Qzero)));
8383 set_specifier_caching (Vright_margin_width, 8355 set_specifier_caching (Vright_margin_width,
8384 slot_offset (struct window, right_margin_width), 8356 slot_offset (struct window, right_margin_width),
8385 some_window_value_changed, 8357 some_window_value_changed,
8386 slot_offset (struct frame, right_margin_width), 8358 slot_offset (struct frame, right_margin_width),
8387 margin_width_changed_in_frame); 8359 margin_width_changed_in_frame);
8389 DEFVAR_SPECIFIER ("minimum-line-ascent", &Vminimum_line_ascent /* 8361 DEFVAR_SPECIFIER ("minimum-line-ascent", &Vminimum_line_ascent /*
8390 *Minimum ascent height of lines. 8362 *Minimum ascent height of lines.
8391 This is a specifier; use `set-specifier' to change it. 8363 This is a specifier; use `set-specifier' to change it.
8392 */ ); 8364 */ );
8393 Vminimum_line_ascent = Fmake_specifier (Qnatnum); 8365 Vminimum_line_ascent = Fmake_specifier (Qnatnum);
8394 set_specifier_fallback (Vminimum_line_ascent, 8366 set_specifier_fallback (Vminimum_line_ascent, list1 (Fcons (Qnil, Qzero)));
8395 list1 (Fcons (Qnil, Qzero)));
8396 set_specifier_caching (Vminimum_line_ascent, 8367 set_specifier_caching (Vminimum_line_ascent,
8397 slot_offset (struct window, 8368 slot_offset (struct window, minimum_line_ascent),
8398 minimum_line_ascent),
8399 some_window_value_changed, 8369 some_window_value_changed,
8400 0, 0); 8370 0, 0);
8401 8371
8402 DEFVAR_SPECIFIER ("minimum-line-descent", &Vminimum_line_descent /* 8372 DEFVAR_SPECIFIER ("minimum-line-descent", &Vminimum_line_descent /*
8403 *Minimum descent height of lines. 8373 *Minimum descent height of lines.
8404 This is a specifier; use `set-specifier' to change it. 8374 This is a specifier; use `set-specifier' to change it.
8405 */ ); 8375 */ );
8406 Vminimum_line_descent = Fmake_specifier (Qnatnum); 8376 Vminimum_line_descent = Fmake_specifier (Qnatnum);
8407 set_specifier_fallback (Vminimum_line_descent, 8377 set_specifier_fallback (Vminimum_line_descent, list1 (Fcons (Qnil, Qzero)));
8408 list1 (Fcons (Qnil, Qzero)));
8409 set_specifier_caching (Vminimum_line_descent, 8378 set_specifier_caching (Vminimum_line_descent,
8410 slot_offset (struct window, 8379 slot_offset (struct window, minimum_line_descent),
8411 minimum_line_descent),
8412 some_window_value_changed, 8380 some_window_value_changed,
8413 0, 0); 8381 0, 0);
8414 8382
8415 DEFVAR_SPECIFIER ("use-left-overflow", &Vuse_left_overflow /* 8383 DEFVAR_SPECIFIER ("use-left-overflow", &Vuse_left_overflow /*
8416 *Non-nil means use the left outside margin as extra whitespace when 8384 *Non-nil means use the left outside margin as extra whitespace when
8417 displaying 'whitespace or 'inside-margin glyphs. 8385 displaying 'whitespace or 'inside-margin glyphs.
8418 This is a specifier; use `set-specifier' to change it. 8386 This is a specifier; use `set-specifier' to change it.
8419 */ ); 8387 */ );
8420 Vuse_left_overflow = Fmake_specifier (Qboolean); 8388 Vuse_left_overflow = Fmake_specifier (Qboolean);
8421 set_specifier_fallback (Vuse_left_overflow, 8389 set_specifier_fallback (Vuse_left_overflow, list1 (Fcons (Qnil, Qnil)));
8422 list1 (Fcons (Qnil, Qnil)));
8423 set_specifier_caching (Vuse_left_overflow, 8390 set_specifier_caching (Vuse_left_overflow,
8424 slot_offset (struct window, 8391 slot_offset (struct window, use_left_overflow),
8425 use_left_overflow),
8426 some_window_value_changed, 8392 some_window_value_changed,
8427 0, 0); 8393 0, 0);
8428 8394
8429 DEFVAR_SPECIFIER ("use-right-overflow", &Vuse_right_overflow /* 8395 DEFVAR_SPECIFIER ("use-right-overflow", &Vuse_right_overflow /*
8430 *Non-nil means use the right outside margin as extra whitespace when 8396 *Non-nil means use the right outside margin as extra whitespace when
8431 displaying 'whitespace or 'inside-margin glyphs. 8397 displaying 'whitespace or 'inside-margin glyphs.
8432 This is a specifier; use `set-specifier' to change it. 8398 This is a specifier; use `set-specifier' to change it.
8433 */ ); 8399 */ );
8434 Vuse_right_overflow = Fmake_specifier (Qboolean); 8400 Vuse_right_overflow = Fmake_specifier (Qboolean);
8435 set_specifier_fallback (Vuse_right_overflow, 8401 set_specifier_fallback (Vuse_right_overflow, list1 (Fcons (Qnil, Qnil)));
8436 list1 (Fcons (Qnil, Qnil)));
8437 set_specifier_caching (Vuse_right_overflow, 8402 set_specifier_caching (Vuse_right_overflow,
8438 slot_offset (struct window, 8403 slot_offset (struct window, use_right_overflow),
8439 use_right_overflow),
8440 some_window_value_changed, 8404 some_window_value_changed,
8441 0, 0); 8405 0, 0);
8442 8406
8443 DEFVAR_SPECIFIER ("text-cursor-visible-p", &Vtext_cursor_visible_p /* 8407 DEFVAR_SPECIFIER ("text-cursor-visible-p", &Vtext_cursor_visible_p /*
8444 *Non-nil means the text cursor is visible (this is usually the case). 8408 *Non-nil means the text cursor is visible (this is usually the case).
8445 This is a specifier; use `set-specifier' to change it. 8409 This is a specifier; use `set-specifier' to change it.
8446 */ ); 8410 */ );
8447 Vtext_cursor_visible_p = Fmake_specifier (Qboolean); 8411 Vtext_cursor_visible_p = Fmake_specifier (Qboolean);
8448 set_specifier_fallback (Vtext_cursor_visible_p, 8412 set_specifier_fallback (Vtext_cursor_visible_p, list1 (Fcons (Qnil, Qt)));
8449 list1 (Fcons (Qnil, Qt)));
8450 set_specifier_caching (Vtext_cursor_visible_p, 8413 set_specifier_caching (Vtext_cursor_visible_p,
8451 slot_offset (struct window, 8414 slot_offset (struct window, text_cursor_visible_p),
8452 text_cursor_visible_p),
8453 text_cursor_visible_p_changed, 8415 text_cursor_visible_p_changed,
8454 0, 0); 8416 0, 0);
8455 8417
8456 } 8418 }