Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | c0965ff3b039 |
children | b9518feda344 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
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 #ifdef MULE | |
61 #include "mule-coding.h" | |
62 #endif | |
60 | 63 |
61 /* Note: We have to be careful throughout this code to properly handle | 64 /* Note: We have to be careful throughout this code to properly handle |
62 and differentiate between Bufbytes and Emchars. | 65 and differentiate between Bufbytes and Emchars. |
63 | 66 |
64 Since strings are generally composed of Bufbytes, I've taken the tack | 67 Since strings are generally composed of Bufbytes, I've taken the tack |
103 add_emchar_rune(). */ | 106 add_emchar_rune(). */ |
104 Lisp_Object last_charset; /* The charset of the previous character. | 107 Lisp_Object last_charset; /* The charset of the previous character. |
105 Used to optimize some lookups -- we | 108 Used to optimize some lookups -- we |
106 only have to do some things when | 109 only have to do some things when |
107 the charset changes. */ | 110 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 | |
112 int last_char_width; /* The width of the previous character. */ | 111 int last_char_width; /* The width of the previous character. */ |
113 int font_is_bogus; /* If true, it means we couldn't instantiate | 112 int font_is_bogus; /* If true, it means we couldn't instantiate |
114 the font for this charset, so we substitute | 113 the font for this charset, so we substitute |
115 ~'s from the ASCII charset. */ | 114 ~'s from the ASCII charset. */ |
116 Bytind bi_bufpos; | 115 Bytind bi_bufpos; |
275 int overlay_width); | 274 int overlay_width); |
276 static void create_right_glyph_block (struct window *w, | 275 static void create_right_glyph_block (struct window *w, |
277 struct display_line *dl); | 276 struct display_line *dl); |
278 static void regenerate_window (struct window *w, Bufpos start_pos, | 277 static void regenerate_window (struct window *w, Bufpos start_pos, |
279 Bufpos point, int type); | 278 Bufpos point, int type); |
280 static Bufpos regenerate_window_point_center (struct window *w, Bufpos point, | 279 static void regenerate_window_point_center (struct window *w, Bufpos point, |
281 int type); | 280 int type); |
282 int window_half_pixpos (struct window *w); | 281 int window_half_pixpos (struct window *w); |
283 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point); | 282 int line_at_center (struct window *w, int type, Bufpos start, Bufpos point); |
284 Bufpos point_at_center (struct window *w, int type, Bufpos start, | 283 Bufpos point_at_center (struct window *w, int type, Bufpos start, |
285 Bufpos point); | 284 Bufpos point); |
286 static void redisplay_window (Lisp_Object window, int skip_selected); | 285 static void redisplay_window (Lisp_Object window, int skip_selected); |
463 #define INHIBIT_REDISPLAY_HOOKS /* #### Until we've thought about | 462 #define INHIBIT_REDISPLAY_HOOKS /* #### Until we've thought about |
464 this more. */ | 463 this more. */ |
465 #ifndef INHIBIT_REDISPLAY_HOOKS | 464 #ifndef INHIBIT_REDISPLAY_HOOKS |
466 /* #### Chuck says: I think this needs more thought. | 465 /* #### Chuck says: I think this needs more thought. |
467 Think about this for 19.14. */ | 466 Think about this for 19.14. */ |
468 /* 19.16: We're still thinking, I guess. -slb */ | |
469 Lisp_Object Vpre_redisplay_hook, Vpost_redisplay_hook; | 467 Lisp_Object Vpre_redisplay_hook, Vpost_redisplay_hook; |
470 Lisp_Object Qpre_redisplay_hook, Qpost_redisplay_hook; | 468 Lisp_Object Qpre_redisplay_hook, Qpost_redisplay_hook; |
471 #endif | 469 #endif |
472 | 470 |
473 int last_display_warning_tick, display_warning_tick; | 471 int last_display_warning_tick, display_warning_tick; |
477 Lisp_Object Vleft_margin_width, Vright_margin_width; | 475 Lisp_Object Vleft_margin_width, Vright_margin_width; |
478 Lisp_Object Vminimum_line_ascent, Vminimum_line_descent; | 476 Lisp_Object Vminimum_line_ascent, Vminimum_line_descent; |
479 Lisp_Object Vuse_left_overflow, Vuse_right_overflow; | 477 Lisp_Object Vuse_left_overflow, Vuse_right_overflow; |
480 Lisp_Object Vtext_cursor_visible_p; | 478 Lisp_Object Vtext_cursor_visible_p; |
481 | 479 |
482 int column_number_start_at_one; | |
483 | 480 |
484 /***************************************************************************/ | 481 /***************************************************************************/ |
485 /* */ | 482 /* */ |
486 /* low-level interfaces onto device routines */ | 483 /* low-level interfaces onto device routines */ |
487 /* */ | 484 /* */ |
850 width = data->blank_width; | 847 width = data->blank_width; |
851 } | 848 } |
852 else | 849 else |
853 { | 850 { |
854 Lisp_Object charset = CHAR_CHARSET (data->ch); | 851 Lisp_Object charset = CHAR_CHARSET (data->ch); |
855 if (!EQ (charset, data->last_charset) || | 852 if (!EQ (charset, data->last_charset)) |
856 data->findex != data->last_findex) | |
857 { | 853 { |
858 /* OK, we need to do things the hard way. */ | 854 /* OK, we need to do things the hard way. */ |
859 struct window *w = XWINDOW (data->window); | 855 struct window *w = XWINDOW (data->window); |
860 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); | 856 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, data->findex); |
861 Lisp_Object font_instance = | 857 Lisp_Object font_instance = |
877 data->last_char_width = fi->width; | 873 data->last_char_width = fi->width; |
878 else | 874 else |
879 data->last_char_width = -1; | 875 data->last_char_width = -1; |
880 data->new_ascent = max (data->new_ascent, (int) fi->ascent); | 876 data->new_ascent = max (data->new_ascent, (int) fi->ascent); |
881 data->new_descent = max (data->new_descent, (int) fi->descent); | 877 data->new_descent = max (data->new_descent, (int) fi->descent); |
882 data->last_charset = charset; | |
883 data->last_findex = data->findex; | |
884 } | 878 } |
885 | 879 |
886 width = data->last_char_width; | 880 width = data->last_char_width; |
887 if (width < 0) | 881 if (width < 0) |
888 { | 882 { |
1878 data.dl = dl; | 1872 data.dl = dl; |
1879 | 1873 |
1880 data.bi_bufpos = bi_start_pos; | 1874 data.bi_bufpos = bi_start_pos; |
1881 data.pixpos = dl->bounds.left_in; | 1875 data.pixpos = dl->bounds.left_in; |
1882 data.last_charset = Qunbound; | 1876 data.last_charset = Qunbound; |
1883 data.last_findex = DEFAULT_INDEX; | |
1884 data.result_str = Qnil; | 1877 data.result_str = Qnil; |
1885 | 1878 |
1886 /* Set the right boundary adjusting it to take into account any end | 1879 /* Set the right boundary adjusting it to take into account any end |
1887 glyph. Save the width of the end glyph for later use. */ | 1880 glyph. Save the width of the end glyph for later use. */ |
1888 data.max_pixpos = dl->bounds.right_in; | 1881 data.max_pixpos = dl->bounds.right_in; |
1902 else | 1895 else |
1903 data.cursor_type = NO_CURSOR; | 1896 data.cursor_type = NO_CURSOR; |
1904 } | 1897 } |
1905 else if (MINI_WINDOW_P (w) && !active_minibuffer) | 1898 else if (MINI_WINDOW_P (w) && !active_minibuffer) |
1906 data.cursor_type = NO_CURSOR; | 1899 data.cursor_type = NO_CURSOR; |
1907 else if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)) && | 1900 else if (w == XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d)))) |
1908 EQ(DEVICE_CONSOLE(d), Vselected_console) && | |
1909 d == XDEVICE(CONSOLE_SELECTED_DEVICE(XCONSOLE(DEVICE_CONSOLE(d))))&& | |
1910 f == XFRAME(DEVICE_SELECTED_FRAME(d))) | |
1911 { | 1901 { |
1912 data.bi_cursor_bufpos = BI_BUF_PT (b); | 1902 data.bi_cursor_bufpos = BI_BUF_PT (b); |
1913 data.cursor_type = CURSOR_ON; | 1903 data.cursor_type = CURSOR_ON; |
1914 } | 1904 } |
1915 else if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) | 1905 else if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) |
2426 bi_pos = bi_find_next_newline_no_quit (b, data.bi_bufpos, 1); | 2416 bi_pos = bi_find_next_newline_no_quit (b, data.bi_bufpos, 1); |
2427 | 2417 |
2428 /* If the cursor is past the truncation line then we | 2418 /* If the cursor is past the truncation line then we |
2429 make it appear on the truncation glyph. If we've hit | 2419 make it appear on the truncation glyph. If we've hit |
2430 the end of the buffer then we also make the cursor | 2420 the end of the buffer then we also make the cursor |
2431 appear unless eob is immediately preceded by a | 2421 appear unless eob is immediately preceeded by a |
2432 newline. In that case the cursor should actually | 2422 newline. In that case the cursor should actually |
2433 appear on the next line. */ | 2423 appear on the next line. */ |
2434 if (data.cursor_type == CURSOR_ON | 2424 if (data.cursor_type == CURSOR_ON |
2435 && data.bi_cursor_bufpos >= data.bi_bufpos | 2425 && data.bi_cursor_bufpos >= data.bi_bufpos |
2436 && (data.bi_cursor_bufpos < bi_pos || | 2426 && (data.bi_cursor_bufpos < bi_pos || |
2648 data.max_pixpos = dl->bounds.right_in; | 2638 data.max_pixpos = dl->bounds.right_in; |
2649 data.cursor_type = NO_CURSOR; | 2639 data.cursor_type = NO_CURSOR; |
2650 data.cursor_x = -1; | 2640 data.cursor_x = -1; |
2651 data.findex = DEFAULT_INDEX; | 2641 data.findex = DEFAULT_INDEX; |
2652 data.last_charset = Qunbound; | 2642 data.last_charset = Qunbound; |
2653 data.last_findex = DEFAULT_INDEX; | |
2654 data.result_str = Qnil; | 2643 data.result_str = Qnil; |
2655 | 2644 |
2656 Dynarr_reset (data.db->runes); | 2645 Dynarr_reset (data.db->runes); |
2657 | 2646 |
2658 if (STRINGP (Voverlay_arrow_string)) | 2647 if (STRINGP (Voverlay_arrow_string)) |
3576 data.findex = findex; | 3565 data.findex = findex; |
3577 data.pixpos = min_pixpos; | 3566 data.pixpos = min_pixpos; |
3578 data.max_pixpos = max_pixpos; | 3567 data.max_pixpos = max_pixpos; |
3579 data.cursor_type = NO_CURSOR; | 3568 data.cursor_type = NO_CURSOR; |
3580 data.last_charset = Qunbound; | 3569 data.last_charset = Qunbound; |
3581 data.last_findex = DEFAULT_INDEX; | |
3582 data.result_str = result_str; | 3570 data.result_str = result_str; |
3583 data.is_modeline = 1; | 3571 data.is_modeline = 1; |
3584 XSETWINDOW (data.window, w); | 3572 XSETWINDOW (data.window, w); |
3585 | 3573 |
3586 Dynarr_reset (formatted_string_extent_dynarr); | 3574 Dynarr_reset (formatted_string_extent_dynarr); |
4786 /* Oh, well. */ | 4774 /* Oh, well. */ |
4787 return 0; | 4775 return 0; |
4788 } | 4776 } |
4789 | 4777 |
4790 /* Given a window and a point, update the given display lines such | 4778 /* Given a window and a point, update the given display lines such |
4791 that point is displayed in the middle of the window. | 4779 that point is displayed in the middle of the window. */ |
4792 Return the window's new start position. */ | 4780 |
4793 | 4781 static void |
4794 static Bufpos | |
4795 regenerate_window_point_center (struct window *w, Bufpos point, int type) | 4782 regenerate_window_point_center (struct window *w, Bufpos point, int type) |
4796 { | 4783 { |
4797 Bufpos startp; | 4784 Bufpos startp; |
4798 | 4785 |
4799 /* We need to make sure that the modeline is generated so that the | 4786 /* We need to make sure that the modeline is generated so that the |
4802 | 4789 |
4803 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w)); | 4790 startp = start_with_line_at_pixpos (w, point, window_half_pixpos (w)); |
4804 regenerate_window (w, startp, point, type); | 4791 regenerate_window (w, startp, point, type); |
4805 Fset_marker (w->start[type], make_int (startp), w->buffer); | 4792 Fset_marker (w->start[type], make_int (startp), w->buffer); |
4806 | 4793 |
4807 return startp; | 4794 return; |
4808 } | 4795 } |
4809 | 4796 |
4810 /* Given a window and a set of display lines, return a boolean | 4797 /* Given a window and a set of display lines, return a boolean |
4811 indicating whether the given point is contained within. */ | 4798 indicating whether the given point is contained within. */ |
4812 | 4799 |
4924 Lisp_Object old_buffer = w->buffer; | 4911 Lisp_Object old_buffer = w->buffer; |
4925 struct buffer *b; | 4912 struct buffer *b; |
4926 int echo_active = 0; | 4913 int echo_active = 0; |
4927 int startp = 1; | 4914 int startp = 1; |
4928 int pointm; | 4915 int pointm; |
4929 int selected_in_its_frame; | 4916 int selected; |
4930 int selected_globally; | |
4931 int skip_output = 0; | 4917 int skip_output = 0; |
4932 int truncation_changed; | 4918 int truncation_changed; |
4933 int inactive_minibuffer = | 4919 int inactive_minibuffer = |
4934 (MINI_WINDOW_P (w) && | 4920 (MINI_WINDOW_P (w) && |
4935 (f != device_selected_frame (d)) && | 4921 (f != device_selected_frame (d)) && |
4952 redisplay_windows (w->hchild, skip_selected); | 4938 redisplay_windows (w->hchild, skip_selected); |
4953 return; | 4939 return; |
4954 } | 4940 } |
4955 | 4941 |
4956 /* Is this window the selected window on its frame? */ | 4942 /* Is this window the selected window on its frame? */ |
4957 selected_in_its_frame = (w == XWINDOW (FRAME_SELECTED_WINDOW (f))); | 4943 selected = |
4958 selected_globally = | 4944 (w == XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d)))); |
4959 selected_in_its_frame && | 4945 if (skip_selected && selected) |
4960 EQ(DEVICE_CONSOLE(d), Vselected_console) && | |
4961 XDEVICE(CONSOLE_SELECTED_DEVICE(XCONSOLE(DEVICE_CONSOLE(d)))) == d && | |
4962 XFRAME(DEVICE_SELECTED_FRAME(d)) == f; | |
4963 if (skip_selected && selected_in_its_frame) | |
4964 return; | 4946 return; |
4965 | 4947 |
4966 /* It is possible that the window is not fully initialized yet. */ | 4948 /* It is possible that the window is not fully initialized yet. */ |
4967 if (NILP (w->buffer)) | 4949 if (NILP (w->buffer)) |
4968 return; | 4950 return; |
4977 | 4959 |
4978 if (echo_active) | 4960 if (echo_active) |
4979 pointm = 1; | 4961 pointm = 1; |
4980 else | 4962 else |
4981 { | 4963 { |
4982 if (selected_globally) | 4964 if (selected) |
4983 { | 4965 { |
4984 pointm = BUF_PT (b); | 4966 pointm = BUF_PT (b); |
4985 } | 4967 } |
4986 else | 4968 else |
4987 { | 4969 { |
5014 /* If the marker's buffer is not the window's buffer, then we need | 4996 /* If the marker's buffer is not the window's buffer, then we need |
5015 to find a new starting position. */ | 4997 to find a new starting position. */ |
5016 if (!MINI_WINDOW_P (w) | 4998 if (!MINI_WINDOW_P (w) |
5017 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer)) | 4999 && !EQ (Fmarker_buffer (w->start[CURRENT_DISP]), w->buffer)) |
5018 { | 5000 { |
5019 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5001 regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5020 | 5002 |
5021 goto regeneration_done; | 5003 goto regeneration_done; |
5022 } | 5004 } |
5023 | 5005 |
5024 if (echo_active) | 5006 if (echo_active) |
5049 | 5031 |
5050 if (!point_visible (w, pointm, DESIRED_DISP) && !inactive_minibuffer) | 5032 if (!point_visible (w, pointm, DESIRED_DISP) && !inactive_minibuffer) |
5051 { | 5033 { |
5052 pointm = point_at_center (w, DESIRED_DISP, 0, 0); | 5034 pointm = point_at_center (w, DESIRED_DISP, 0, 0); |
5053 | 5035 |
5054 if (selected_globally) | 5036 if (selected) |
5055 BUF_SET_PT (b, pointm); | 5037 BUF_SET_PT (b, pointm); |
5056 | 5038 |
5057 Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), | 5039 Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), |
5058 old_buffer); | 5040 old_buffer); |
5059 | 5041 |
5077 && !truncation_changed) | 5059 && !truncation_changed) |
5078 { | 5060 { |
5079 /* Check if the cursor has actually moved. */ | 5061 /* Check if the cursor has actually moved. */ |
5080 if (EQ (Fmarker_buffer (w->last_point[CURRENT_DISP]), w->buffer) | 5062 if (EQ (Fmarker_buffer (w->last_point[CURRENT_DISP]), w->buffer) |
5081 && pointm == marker_position (w->last_point[CURRENT_DISP]) | 5063 && pointm == marker_position (w->last_point[CURRENT_DISP]) |
5082 && selected_globally | 5064 && selected |
5083 && !w->windows_changed | 5065 && !w->windows_changed |
5084 && !f->clip_changed | 5066 && !f->clip_changed |
5085 && !f->extents_changed | 5067 && !f->extents_changed |
5086 && !f->faces_changed | 5068 && !f->faces_changed |
5087 && !f->point_changed | 5069 && !f->point_changed |
5117 | 5099 |
5118 skip_output = 1; | 5100 skip_output = 1; |
5119 goto regeneration_done; | 5101 goto regeneration_done; |
5120 } | 5102 } |
5121 } | 5103 } |
5122 else if (!selected_in_its_frame && !f->point_changed) | 5104 else if (!selected && !f->point_changed) |
5123 { | 5105 { |
5124 if (f->modeline_changed) | 5106 if (f->modeline_changed) |
5125 regenerate_modeline (w); | 5107 regenerate_modeline (w); |
5126 | 5108 |
5127 skip_output = 1; | 5109 skip_output = 1; |
5148 || (pointm == startp && | 5130 || (pointm == startp && |
5149 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) && | 5131 EQ (Fmarker_buffer (w->last_start[CURRENT_DISP]), w->buffer) && |
5150 startp < marker_position (w->last_start[CURRENT_DISP])) | 5132 startp < marker_position (w->last_start[CURRENT_DISP])) |
5151 || (startp == BUF_ZV (b))) | 5133 || (startp == BUF_ZV (b))) |
5152 { | 5134 { |
5153 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5135 regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5154 | 5136 |
5155 goto regeneration_done; | 5137 goto regeneration_done; |
5156 } | 5138 } |
5157 /* See if we can update the data structures locally based on | 5139 /* See if we can update the data structures locally based on |
5158 knowledge of what changed in the buffer. */ | 5140 knowledge of what changed in the buffer. */ |
5186 /* We still haven't gotten the window regenerated with point | 5168 /* We still haven't gotten the window regenerated with point |
5187 visible. Next we try scrolling a little and see if point comes | 5169 visible. Next we try scrolling a little and see if point comes |
5188 back onto the screen. */ | 5170 back onto the screen. */ |
5189 if (scroll_step) | 5171 if (scroll_step) |
5190 { | 5172 { |
5191 startp = vmotion (w, startp, | 5173 Bufpos bufpos; |
5174 | |
5175 bufpos = vmotion (w, startp, | |
5192 (pointm < startp) ? -scroll_step : scroll_step, 0); | 5176 (pointm < startp) ? -scroll_step : scroll_step, 0); |
5193 regenerate_window (w, startp, pointm, DESIRED_DISP); | 5177 regenerate_window (w, bufpos, pointm, DESIRED_DISP); |
5194 | 5178 |
5195 if (point_visible (w, pointm, DESIRED_DISP)) | 5179 if (point_visible (w, pointm, DESIRED_DISP)) |
5196 goto regeneration_done; | 5180 goto regeneration_done; |
5197 } | 5181 } |
5198 | 5182 |
5199 /* We still haven't managed to get the screen drawn with point on | 5183 /* We still haven't managed to get the screen drawn with point on |
5200 the screen, so just center it and be done with it. */ | 5184 the screen, so just center it and be done with it. */ |
5201 startp = regenerate_window_point_center (w, pointm, DESIRED_DISP); | 5185 regenerate_window_point_center (w, pointm, DESIRED_DISP); |
5202 | 5186 |
5203 | 5187 |
5204 regeneration_done: | 5188 regeneration_done: |
5205 | 5189 |
5206 /* If the window's frame is changed then reset the current display | 5190 /* If the window's frame is changed then reset the current display |
5260 | 5244 |
5261 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | 5245 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) |
5262 { | 5246 { |
5263 struct frame *f = XFRAME (XCAR (frmcons)); | 5247 struct frame *f = XFRAME (XCAR (frmcons)); |
5264 | 5248 |
5265 if (FRAME_REPAINT_P (f)) | 5249 if (FRAME_VISIBLE_P (f)) |
5266 map_windows (f, reset_buffer_changes_mapfun, 0); | 5250 map_windows (f, reset_buffer_changes_mapfun, 0); |
5267 } | 5251 } |
5268 } | 5252 } |
5269 | 5253 |
5270 /* Ensure that all windows underneath the given window in the window | 5254 /* Ensure that all windows underneath the given window in the window |
5465 f = XFRAME (frame); | 5449 f = XFRAME (frame); |
5466 | 5450 |
5467 if (f->icon_changed || f->windows_changed) | 5451 if (f->icon_changed || f->windows_changed) |
5468 update_frame_icon (f); | 5452 update_frame_icon (f); |
5469 | 5453 |
5470 if (FRAME_REPAINT_P (f)) | 5454 if (FRAME_VISIBLE_P (f)) |
5471 { | 5455 { |
5472 if (f->buffers_changed || f->clip_changed || f->extents_changed | 5456 if (f->buffers_changed || f->clip_changed || f->extents_changed |
5473 || f->faces_changed || f->frame_changed || f->menubar_changed | 5457 || f->faces_changed || f->frame_changed || f->menubar_changed |
5474 || f->modeline_changed || f->point_changed || f->size_changed | 5458 || f->modeline_changed || f->point_changed || f->size_changed |
5475 || f->toolbar_changed || f->windows_changed | 5459 || f->toolbar_changed || f->windows_changed |
5499 continue; | 5483 continue; |
5500 | 5484 |
5501 if (f->icon_changed || f->windows_changed) | 5485 if (f->icon_changed || f->windows_changed) |
5502 update_frame_icon (f); | 5486 update_frame_icon (f); |
5503 | 5487 |
5504 if (FRAME_REPAINT_P (f)) | 5488 if (FRAME_VISIBLE_P (f)) |
5505 { | 5489 { |
5506 if (f->buffers_changed || f->clip_changed || f->extents_changed | 5490 if (f->buffers_changed || f->clip_changed || f->extents_changed |
5507 || f->faces_changed || f->frame_changed || f->menubar_changed | 5491 || f->faces_changed || f->frame_changed || f->menubar_changed |
5508 || f->modeline_changed || f->point_changed || f->size_changed | 5492 || f->modeline_changed || f->point_changed || f->size_changed |
5509 || f->toolbar_changed || f->windows_changed | 5493 || f->toolbar_changed || f->windows_changed |
5671 window_line_number (struct window *w, int type) | 5655 window_line_number (struct window *w, int type) |
5672 { | 5656 { |
5673 struct device *d = XDEVICE (XFRAME (w->frame)->device); | 5657 struct device *d = XDEVICE (XFRAME (w->frame)->device); |
5674 struct buffer *b = XBUFFER (w->buffer); | 5658 struct buffer *b = XBUFFER (w->buffer); |
5675 Bufpos end = | 5659 Bufpos end = |
5676 (((w == XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d)))) && | 5660 ((w == XWINDOW (FRAME_SELECTED_WINDOW (device_selected_frame (d)))) |
5677 EQ(DEVICE_CONSOLE(d), Vselected_console) && | |
5678 XDEVICE(CONSOLE_SELECTED_DEVICE(XCONSOLE(DEVICE_CONSOLE(d)))) == d && | |
5679 EQ(DEVICE_SELECTED_FRAME(d), w->frame)) | |
5680 ? BUF_PT (b) | 5661 ? BUF_PT (b) |
5681 : marker_position (w->pointm[type])); | 5662 : marker_position (w->pointm[type])); |
5682 int lots = 999999999; | 5663 int lots = 999999999; |
5683 int shortage, line; | 5664 int shortage, line; |
5684 | 5665 |
5720 break; | 5701 break; |
5721 | 5702 |
5722 /* print the current column */ | 5703 /* print the current column */ |
5723 case 'c': | 5704 case 'c': |
5724 { | 5705 { |
5725 int col = current_column (b) + (column_number_start_at_one != 0); | 5706 int col = current_column (b); |
5726 int temp = col; | 5707 int temp = col; |
5727 int size = 2; | 5708 int size = 2; |
5728 char *buf; | 5709 char *buf; |
5729 | 5710 |
5730 while (temp >= 10) | 5711 while (temp >= 10) |
5740 (CONST Bufbyte *) buf, strlen (buf)); | 5721 (CONST Bufbyte *) buf, strlen (buf)); |
5741 | 5722 |
5742 goto decode_mode_spec_done; | 5723 goto decode_mode_spec_done; |
5743 } | 5724 } |
5744 | 5725 |
5726 #ifdef MULE | |
5727 /* print the file coding system */ | |
5728 case 'C': | |
5729 { | |
5730 Lisp_Object codesys = b->file_coding_system; | |
5731 /* Be very careful here not to get an error. */ | |
5732 if (NILP (codesys) || SYMBOLP (codesys) || CODING_SYSTEMP (codesys)) | |
5733 { | |
5734 codesys = Ffind_coding_system (codesys); | |
5735 if (CODING_SYSTEMP (codesys)) | |
5736 obj = Fcoding_system_property (codesys, Qmnemonic); | |
5737 } | |
5738 } | |
5739 break; | |
5740 #endif | |
5745 | 5741 |
5746 /* print the current line number */ | 5742 /* print the current line number */ |
5747 case 'l': | 5743 case 'l': |
5748 str = window_line_number (w, type); | 5744 str = window_line_number (w, type); |
5749 break; | 5745 break; |
6644 Bufpos | 6640 Bufpos |
6645 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) | 6641 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) |
6646 { | 6642 { |
6647 struct buffer *b = XBUFFER (w->buffer); | 6643 struct buffer *b = XBUFFER (w->buffer); |
6648 int cur_elt; | 6644 int cur_elt; |
6649 Bufpos cur_pos, prev_pos = point; | 6645 Bufpos cur_pos; |
6650 int point_line_height; | |
6651 int pixheight = pixpos - WINDOW_TEXT_TOP (w); | 6646 int pixheight = pixpos - WINDOW_TEXT_TOP (w); |
6652 | 6647 |
6653 validate_line_start_cache (w); | 6648 validate_line_start_cache (w); |
6654 w->line_cache_validation_override++; | 6649 w->line_cache_validation_override++; |
6655 | 6650 |
6656 cur_elt = point_in_line_start_cache (w, point, 0); | 6651 cur_elt = point_in_line_start_cache (w, point, 0); |
6657 /* #### See comment in update_line_start_cache about big minibuffers. */ | 6652 /* #### See comment in update_line_start_cache about big minibuffers. */ |
6658 if (cur_elt < 0) | 6653 if (cur_elt < 0) |
6659 return point; | 6654 return point; |
6660 | |
6661 point_line_height = Dynarr_atp (w->line_start_cache, cur_elt)->height; | |
6662 | |
6663 while (1) | 6655 while (1) |
6664 { | 6656 { |
6665 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; | 6657 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; |
6666 | 6658 |
6667 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; | 6659 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; |
6669 /* Do not take into account the value of vertical_clip here. | 6661 /* Do not take into account the value of vertical_clip here. |
6670 That is the responsibility of the calling functions. */ | 6662 That is the responsibility of the calling functions. */ |
6671 if (pixheight < 0) | 6663 if (pixheight < 0) |
6672 { | 6664 { |
6673 w->line_cache_validation_override--; | 6665 w->line_cache_validation_override--; |
6674 if (-pixheight > point_line_height) | 6666 return cur_pos; |
6675 /* We can't make the target line cover pixpos, so put it | |
6676 above pixpos. That way it will at least be visible. */ | |
6677 return prev_pos; | |
6678 else | |
6679 return cur_pos; | |
6680 } | 6667 } |
6681 | 6668 |
6682 cur_elt--; | 6669 cur_elt--; |
6683 if (cur_elt < 0) | 6670 if (cur_elt < 0) |
6684 { | 6671 { |
6700 update_line_start_cache (w, from, to, point, 0); | 6687 update_line_start_cache (w, from, to, point, 0); |
6701 | 6688 |
6702 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; | 6689 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; |
6703 assert (cur_elt >= 0); | 6690 assert (cur_elt >= 0); |
6704 } | 6691 } |
6705 prev_pos = cur_pos; | |
6706 } | 6692 } |
6707 } | 6693 } |
6708 | 6694 |
6709 /* For window W, what does the starting position have to be so that | 6695 /* For window W, what does the starting position have to be so that |
6710 the line containing point is on display line LINE. If LINE is | 6696 the line containing point is on display line LINE. If LINE is |
7528 Dynarr_atp (db->runes, | 7514 Dynarr_atp (db->runes, |
7529 Dynarr_length (db->runes) - 1)->bufpos; | 7515 Dynarr_length (db->runes) - 1)->bufpos; |
7530 else | 7516 else |
7531 *closest = | 7517 *closest = |
7532 Dynarr_atp (db->runes, | 7518 Dynarr_atp (db->runes, |
7533 Dynarr_length (db->runes) - 2)->bufpos; | 7519 Dynarr_length (db->runes) - 1)->bufpos; |
7534 } | 7520 } |
7535 | 7521 |
7536 if (dl->modeline) | 7522 if (dl->modeline) |
7537 *modeline_closest += dl->offset; | 7523 *modeline_closest += dl->offset; |
7538 else | 7524 else |
7758 | 7744 |
7759 DEVICE_FRAME_LOOP (frmcons, d) | 7745 DEVICE_FRAME_LOOP (frmcons, d) |
7760 { | 7746 { |
7761 struct frame *f = XFRAME (XCAR (frmcons)); | 7747 struct frame *f = XFRAME (XCAR (frmcons)); |
7762 | 7748 |
7763 if (FRAME_REPAINT_P (f) && FRAME_HAS_MINIBUF_P (f)) | 7749 if (FRAME_VISIBLE_P (f) && FRAME_HAS_MINIBUF_P (f)) |
7764 { | 7750 { |
7765 Lisp_Object window = FRAME_MINIBUF_WINDOW (f); | 7751 Lisp_Object window = FRAME_MINIBUF_WINDOW (f); |
7766 redisplay_window (window, 0); | 7752 redisplay_window (window, 0); |
7767 call_redisplay_end_triggers (XWINDOW (window), 0); | 7753 call_redisplay_end_triggers (XWINDOW (window), 0); |
7768 } | 7754 } |
7842 DEVICE defaults to the selected device if omitted. | 7828 DEVICE defaults to the selected device if omitted. |
7843 Normally, redisplay is preempted as normal if input arrives. However, | 7829 Normally, redisplay is preempted as normal if input arrives. However, |
7844 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for | 7830 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for |
7845 input and is guaranteed to proceed to completion. | 7831 input and is guaranteed to proceed to completion. |
7846 */ | 7832 */ |
7847 (device, no_preempt)) | 7833 (device, no_preempt)) |
7848 { | 7834 { |
7849 struct device *d = decode_device (device); | 7835 struct device *d = decode_device (device); |
7850 Lisp_Object frmcons; | 7836 Lisp_Object frmcons; |
7851 int count = specpdl_depth (); | 7837 int count = specpdl_depth (); |
7852 | 7838 |
7908 | 7894 |
7909 DEFUN ("force-cursor-redisplay", Fforce_cursor_redisplay, 0, 1, 0, /* | 7895 DEFUN ("force-cursor-redisplay", Fforce_cursor_redisplay, 0, 1, 0, /* |
7910 Force an immediate update of the cursor on FRAME. | 7896 Force an immediate update of the cursor on FRAME. |
7911 FRAME defaults to the selected frame if omitted. | 7897 FRAME defaults to the selected frame if omitted. |
7912 */ | 7898 */ |
7913 (frame)) | 7899 (frame)) |
7914 { | 7900 { |
7915 redisplay_redraw_cursor (decode_frame (frame), 1); | 7901 redisplay_redraw_cursor (decode_frame (frame), 1); |
7916 return Qnil; | 7902 return Qnil; |
7917 } | 7903 } |
7918 | 7904 |
8219 Emacs's frame display when you reenter Emacs. | 8205 Emacs's frame display when you reenter Emacs. |
8220 It is up to you to set this variable if your terminal can do that. | 8206 It is up to you to set this variable if your terminal can do that. |
8221 */ ); | 8207 */ ); |
8222 no_redraw_on_reenter = 0; | 8208 no_redraw_on_reenter = 0; |
8223 | 8209 |
8210 /* #### This should be removed in 19.14 */ | |
8224 DEFVAR_LISP ("window-system", &Vwindow_system /* | 8211 DEFVAR_LISP ("window-system", &Vwindow_system /* |
8225 A symbol naming the window-system under which Emacs is running, | 8212 A symbol naming the window-system under which Emacs is running, |
8226 such as `x', or nil if emacs is running on an ordinary terminal. | 8213 such as `x', or nil if emacs is running on an ordinary terminal. |
8214 This variable is OBSOLETE and will be removed in a future version. | |
8227 */ ); | 8215 */ ); |
8228 Vwindow_system = Qnil; | 8216 Vwindow_system = Qnil; |
8229 | 8217 |
8230 /* #### Temporary shit until window-system is eliminated. */ | 8218 /* #### Temporary shit until window-system is eliminated. */ |
8231 DEFVAR_LISP ("initial-window-system", &Vinitial_window_system /* | 8219 DEFVAR_LISP ("initial-window-system", &Vinitial_window_system /* |
8308 DEFVAR_LISP ("redisplay-end-trigger-functions", | 8296 DEFVAR_LISP ("redisplay-end-trigger-functions", |
8309 &Vredisplay_end_trigger_functions /* | 8297 &Vredisplay_end_trigger_functions /* |
8310 See `set-window-redisplay-end-trigger'. | 8298 See `set-window-redisplay-end-trigger'. |
8311 */ ); | 8299 */ ); |
8312 Vredisplay_end_trigger_functions = Qnil; | 8300 Vredisplay_end_trigger_functions = Qnil; |
8313 | |
8314 DEFVAR_BOOL ("column-number-start-at-one", &column_number_start_at_one /* | |
8315 Non-nil means column display number starts at 1. | |
8316 */ ); | |
8317 column_number_start_at_one = 1; | |
8318 } | 8301 } |
8319 | 8302 |
8320 void | 8303 void |
8321 specifier_vars_of_redisplay (void) | 8304 specifier_vars_of_redisplay (void) |
8322 { | 8305 { |
8412 set_specifier_caching (Vtext_cursor_visible_p, | 8395 set_specifier_caching (Vtext_cursor_visible_p, |
8413 slot_offset (struct window, | 8396 slot_offset (struct window, |
8414 text_cursor_visible_p), | 8397 text_cursor_visible_p), |
8415 text_cursor_visible_p_changed, | 8398 text_cursor_visible_p_changed, |
8416 0, 0); | 8399 0, 0); |
8417 | 8400 } |
8418 } |