comparison src/redisplay.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children ec9a17fef872
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
103 add_emchar_rune(). */ 103 add_emchar_rune(). */
104 Lisp_Object last_charset; /* The charset of the previous character. 104 Lisp_Object last_charset; /* The charset of the previous character.
105 Used to optimize some lookups -- we 105 Used to optimize some lookups -- we
106 only have to do some things when 106 only have to do some things when
107 the charset changes. */ 107 the charset changes. */
108 face_index last_findex; /* The face index of the previous character.
109 Needed to ensure the validity of the
110 last_charset optimization. */
111
108 int last_char_width; /* The width of the previous character. */ 112 int last_char_width; /* The width of the previous character. */
109 int font_is_bogus; /* If true, it means we couldn't instantiate 113 int font_is_bogus; /* If true, it means we couldn't instantiate
110 the font for this charset, so we substitute 114 the font for this charset, so we substitute
111 ~'s from the ASCII charset. */ 115 ~'s from the ASCII charset. */
112 Bytind bi_bufpos; 116 Bytind bi_bufpos;
845 width = data->blank_width; 849 width = data->blank_width;
846 } 850 }
847 else 851 else
848 { 852 {
849 Lisp_Object charset = CHAR_CHARSET (data->ch); 853 Lisp_Object charset = CHAR_CHARSET (data->ch);
850 if (!EQ (charset, data->last_charset)) 854 if (!EQ (charset, data->last_charset) ||
855 data->findex != data->last_findex)
851 { 856 {
852 /* OK, we need to do things the hard way. */ 857 /* OK, we need to do things the hard way. */
853 struct window *w = XWINDOW (data->window); 858 struct window *w = XWINDOW (data->window);
854 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); 859 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex);
855 Lisp_Object font_instance = 860 Lisp_Object font_instance =
871 data->last_char_width = fi->width; 876 data->last_char_width = fi->width;
872 else 877 else
873 data->last_char_width = -1; 878 data->last_char_width = -1;
874 data->new_ascent = max (data->new_ascent, (int) fi->ascent); 879 data->new_ascent = max (data->new_ascent, (int) fi->ascent);
875 data->new_descent = max (data->new_descent, (int) fi->descent); 880 data->new_descent = max (data->new_descent, (int) fi->descent);
876 /* The following line causes display goobers and I don't know why */ 881 data->last_charset = charset;
877 /*data->last_charset = charset;*/ 882 data->last_findex = data->findex;
878 } 883 }
879 884
880 width = data->last_char_width; 885 width = data->last_char_width;
881 if (width < 0) 886 if (width < 0)
882 { 887 {
1872 data.dl = dl; 1877 data.dl = dl;
1873 1878
1874 data.bi_bufpos = bi_start_pos; 1879 data.bi_bufpos = bi_start_pos;
1875 data.pixpos = dl->bounds.left_in; 1880 data.pixpos = dl->bounds.left_in;
1876 data.last_charset = Qunbound; 1881 data.last_charset = Qunbound;
1882 data.last_findex = DEFAULT_INDEX;
1877 data.result_str = Qnil; 1883 data.result_str = Qnil;
1878 1884
1879 /* Set the right boundary adjusting it to take into account any end 1885 /* Set the right boundary adjusting it to take into account any end
1880 glyph. Save the width of the end glyph for later use. */ 1886 glyph. Save the width of the end glyph for later use. */
1881 data.max_pixpos = dl->bounds.right_in; 1887 data.max_pixpos = dl->bounds.right_in;
2638 data.max_pixpos = dl->bounds.right_in; 2644 data.max_pixpos = dl->bounds.right_in;
2639 data.cursor_type = NO_CURSOR; 2645 data.cursor_type = NO_CURSOR;
2640 data.cursor_x = -1; 2646 data.cursor_x = -1;
2641 data.findex = DEFAULT_INDEX; 2647 data.findex = DEFAULT_INDEX;
2642 data.last_charset = Qunbound; 2648 data.last_charset = Qunbound;
2649 data.last_findex = DEFAULT_INDEX;
2643 data.result_str = Qnil; 2650 data.result_str = Qnil;
2644 2651
2645 Dynarr_reset (data.db->runes); 2652 Dynarr_reset (data.db->runes);
2646 2653
2647 if (STRINGP (Voverlay_arrow_string)) 2654 if (STRINGP (Voverlay_arrow_string))
3565 data.findex = findex; 3572 data.findex = findex;
3566 data.pixpos = min_pixpos; 3573 data.pixpos = min_pixpos;
3567 data.max_pixpos = max_pixpos; 3574 data.max_pixpos = max_pixpos;
3568 data.cursor_type = NO_CURSOR; 3575 data.cursor_type = NO_CURSOR;
3569 data.last_charset = Qunbound; 3576 data.last_charset = Qunbound;
3577 data.last_findex = DEFAULT_INDEX;
3570 data.result_str = result_str; 3578 data.result_str = result_str;
3571 data.is_modeline = 1; 3579 data.is_modeline = 1;
3572 XSETWINDOW (data.window, w); 3580 XSETWINDOW (data.window, w);
3573 3581
3574 Dynarr_reset (formatted_string_extent_dynarr); 3582 Dynarr_reset (formatted_string_extent_dynarr);
7713 /* */ 7721 /* */
7714 /* Lisp functions */ 7722 /* Lisp functions */
7715 /* */ 7723 /* */
7716 /***************************************************************************/ 7724 /***************************************************************************/
7717 7725
7718 DEFUN ("redisplay-echo-area", Fredisplay_echo_area, Sredisplay_echo_area, 7726 DEFUN ("redisplay-echo-area", Fredisplay_echo_area, 0, 0, 0, /*
7719 0, 0, 0 /*
7720 Ensure that all minibuffers are correctly showing the echo area. 7727 Ensure that all minibuffers are correctly showing the echo area.
7721 */ ) 7728 */
7722 () 7729 ())
7723 { 7730 {
7724 Lisp_Object devcons, concons; 7731 Lisp_Object devcons, concons;
7725 7732
7726 DEVICE_LOOP_NO_BREAK (devcons, concons) 7733 DEVICE_LOOP_NO_BREAK (devcons, concons)
7727 { 7734 {
7755 { 7762 {
7756 disable_preemption = XINT (value); 7763 disable_preemption = XINT (value);
7757 return Qnil; 7764 return Qnil;
7758 } 7765 }
7759 7766
7760 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 0, 2, 0 /* 7767 DEFUN ("redraw-frame", Fredraw_frame, 0, 2, 0, /*
7761 Clear frame FRAME and output again what is supposed to appear on it. 7768 Clear frame FRAME and output again what is supposed to appear on it.
7762 FRAME defaults to the selected frame if omitted. 7769 FRAME defaults to the selected frame if omitted.
7763 Normally, redisplay is preempted as normal if input arrives. However, 7770 Normally, redisplay is preempted as normal if input arrives. However,
7764 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for 7771 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for
7765 input and is guaranteed to proceed to completion. 7772 input and is guaranteed to proceed to completion.
7766 */ ) 7773 */
7767 (frame, no_preempt) 7774 (frame, no_preempt))
7768 Lisp_Object frame, no_preempt;
7769 { 7775 {
7770 struct frame *f = decode_frame (frame); 7776 struct frame *f = decode_frame (frame);
7771 int count = specpdl_depth (); 7777 int count = specpdl_depth ();
7772 7778
7773 if (!NILP (no_preempt)) 7779 if (!NILP (no_preempt))
7781 redisplay_frame (f, 1); 7787 redisplay_frame (f, 1);
7782 7788
7783 return unbind_to (count, Qnil); 7789 return unbind_to (count, Qnil);
7784 } 7790 }
7785 7791
7786 DEFUN ("redisplay-frame", Fredisplay_frame, Sredisplay_frame, 0, 2, 0 /* 7792 DEFUN ("redisplay-frame", Fredisplay_frame, 0, 2, 0, /*
7787 Ensure that FRAME's contents are correctly displayed. 7793 Ensure that FRAME's contents are correctly displayed.
7788 This differs from `redraw-frame' in that it only redraws what needs to 7794 This differs from `redraw-frame' in that it only redraws what needs to
7789 be updated, as opposed to unconditionally clearing and redrawing 7795 be updated, as opposed to unconditionally clearing and redrawing
7790 the frame. 7796 the frame.
7791 FRAME defaults to the selected frame if omitted. 7797 FRAME defaults to the selected frame if omitted.
7792 Normally, redisplay is preempted as normal if input arrives. However, 7798 Normally, redisplay is preempted as normal if input arrives. However,
7793 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for 7799 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for
7794 input and is guaranteed to proceed to completion. 7800 input and is guaranteed to proceed to completion.
7795 */ ) 7801 */
7796 (frame, no_preempt) 7802 (frame, no_preempt))
7797 Lisp_Object frame, no_preempt;
7798 { 7803 {
7799 struct frame *f = decode_frame (frame); 7804 struct frame *f = decode_frame (frame);
7800 int count = specpdl_depth (); 7805 int count = specpdl_depth ();
7801 7806
7802 if (!NILP (no_preempt)) 7807 if (!NILP (no_preempt))
7809 redisplay_frame (f, 1); 7814 redisplay_frame (f, 1);
7810 7815
7811 return unbind_to (count, Qnil); 7816 return unbind_to (count, Qnil);
7812 } 7817 }
7813 7818
7814 DEFUN ("redraw-device", Fredraw_device, Sredraw_device, 0, 2, 0 /* 7819 DEFUN ("redraw-device", Fredraw_device, 0, 2, 0, /*
7815 Clear device DEVICE and output again what is supposed to appear on it. 7820 Clear device DEVICE and output again what is supposed to appear on it.
7816 DEVICE defaults to the selected device if omitted. 7821 DEVICE defaults to the selected device if omitted.
7817 Normally, redisplay is preempted as normal if input arrives. However, 7822 Normally, redisplay is preempted as normal if input arrives. However,
7818 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for 7823 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for
7819 input and is guaranteed to proceed to completion. 7824 input and is guaranteed to proceed to completion.
7820 */ ) 7825 */
7821 (device, no_preempt) 7826 (device, no_preempt))
7822 Lisp_Object device, no_preempt;
7823 { 7827 {
7824 struct device *d = decode_device (device); 7828 struct device *d = decode_device (device);
7825 Lisp_Object frmcons; 7829 Lisp_Object frmcons;
7826 int count = specpdl_depth (); 7830 int count = specpdl_depth ();
7827 7831
7839 redisplay_device (d); 7843 redisplay_device (d);
7840 7844
7841 return unbind_to (count, Qnil); 7845 return unbind_to (count, Qnil);
7842 } 7846 }
7843 7847
7844 DEFUN ("redisplay-device", Fredisplay_device, Sredisplay_device, 0, 2, 0 /* 7848 DEFUN ("redisplay-device", Fredisplay_device, 0, 2, 0, /*
7845 Ensure that DEVICE's contents are correctly displayed. 7849 Ensure that DEVICE's contents are correctly displayed.
7846 This differs from `redraw-device' in that it only redraws what needs to 7850 This differs from `redraw-device' in that it only redraws what needs to
7847 be updated, as opposed to unconditionally clearing and redrawing 7851 be updated, as opposed to unconditionally clearing and redrawing
7848 the device. 7852 the device.
7849 DEVICE defaults to the selected device if omitted. 7853 DEVICE defaults to the selected device if omitted.
7850 Normally, redisplay is preempted as normal if input arrives. However, 7854 Normally, redisplay is preempted as normal if input arrives. However,
7851 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for 7855 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for
7852 input and is guaranteed to proceed to completion. 7856 input and is guaranteed to proceed to completion.
7853 */ ) 7857 */
7854 (device, no_preempt) 7858 (device, no_preempt))
7855 Lisp_Object device, no_preempt;
7856 { 7859 {
7857 struct device *d = decode_device (device); 7860 struct device *d = decode_device (device);
7858 int count = specpdl_depth (); 7861 int count = specpdl_depth ();
7859 7862
7860 if (!NILP (no_preempt)) 7863 if (!NILP (no_preempt))
7870 } 7873 }
7871 7874
7872 /* Big lie. Big lie. This will force all modelines to be updated 7875 /* Big lie. Big lie. This will force all modelines to be updated
7873 regardless if the all flag is set or not. It remains in existence 7876 regardless if the all flag is set or not. It remains in existence
7874 solely for backwards compatibility. */ 7877 solely for backwards compatibility. */
7875 DEFUN ("redraw-modeline", Fredraw_modeline, Sredraw_modeline, 0, 1, 0 /* 7878 DEFUN ("redraw-modeline", Fredraw_modeline, 0, 1, 0, /*
7876 Force the modeline of the current buffer to be redisplayed. 7879 Force the modeline of the current buffer to be redisplayed.
7877 With optional non-nil ALL, force redisplay of all modelines. 7880 With optional non-nil ALL, force redisplay of all modelines.
7878 */ ) 7881 */
7879 (all) 7882 (all))
7880 Lisp_Object all;
7881 { 7883 {
7882 MARK_MODELINE_CHANGED; 7884 MARK_MODELINE_CHANGED;
7883 return Qnil; 7885 return Qnil;
7884 } 7886 }
7885 7887
7886 DEFUN ("force-cursor-redisplay", Fforce_cursor_redisplay, 7888 DEFUN ("force-cursor-redisplay", Fforce_cursor_redisplay, 0, 1, 0, /*
7887 Sforce_cursor_redisplay, 0, 1, 0 /*
7888 Force an immediate update of the cursor on FRAME. 7889 Force an immediate update of the cursor on FRAME.
7889 FRAME defaults to the selected frame if omitted. 7890 FRAME defaults to the selected frame if omitted.
7890 */ ) 7891 */
7891 (frame) 7892 (frame))
7892 Lisp_Object frame;
7893 { 7893 {
7894 redisplay_redraw_cursor (decode_frame (frame), 1); 7894 redisplay_redraw_cursor (decode_frame (frame), 1);
7895 return Qnil; 7895 return Qnil;
7896 } 7896 }
7897 7897
8111 defsymbol (&Qbar_cursor, "bar-cursor"); 8111 defsymbol (&Qbar_cursor, "bar-cursor");
8112 defsymbol (&Qwindow_scroll_functions, "window-scroll-functions"); 8112 defsymbol (&Qwindow_scroll_functions, "window-scroll-functions");
8113 defsymbol (&Qredisplay_end_trigger_functions, 8113 defsymbol (&Qredisplay_end_trigger_functions,
8114 "redisplay-end-trigger-functions"); 8114 "redisplay-end-trigger-functions");
8115 8115
8116 defsubr (&Sredisplay_echo_area); 8116 DEFSUBR (Fredisplay_echo_area);
8117 defsubr (&Sredraw_frame); 8117 DEFSUBR (Fredraw_frame);
8118 defsubr (&Sredisplay_frame); 8118 DEFSUBR (Fredisplay_frame);
8119 defsubr (&Sredraw_device); 8119 DEFSUBR (Fredraw_device);
8120 defsubr (&Sredisplay_device); 8120 DEFSUBR (Fredisplay_device);
8121 defsubr (&Sredraw_modeline); 8121 DEFSUBR (Fredraw_modeline);
8122 defsubr (&Sforce_cursor_redisplay); 8122 DEFSUBR (Fforce_cursor_redisplay);
8123 } 8123 }
8124 8124
8125 void 8125 void
8126 vars_of_redisplay (void) 8126 vars_of_redisplay (void)
8127 { 8127 {