aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-11-10 16:18:44 +0000
committerRichard M. Stallman1995-11-10 16:18:44 +0000
commitd3413a53d1d04413c0bccf991ed9bcc0829c7508 (patch)
treef3ecb1553fff6e31f1b65ecddcca72560f2b178c /src
parenta3bee872ef4c0d3da1cf9aa032c90df3f57a9bd6 (diff)
downloademacs-d3413a53d1d04413c0bccf991ed9bcc0829c7508.tar.gz
emacs-d3413a53d1d04413c0bccf991ed9bcc0829c7508.zip
(display_text_line): Get redisplay_end_trigger from window.
(display_string): Detect truncation more carefully. (redisplay_window): On non-X frame, always use FRAME_MENU_BAR_LINES as criterion for whether to display menu bar. (update_menu_bar): Likewise. (display_menu_bar): Do the work here for non-X frames regardless of USE_X_TOOLKIT.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 6731e276b1c..645c6844340 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1284,13 +1284,14 @@ update_menu_bar (f, save_match_data)
1284 if (update_mode_lines) 1284 if (update_mode_lines)
1285 w->update_mode_line = Qt; 1285 w->update_mode_line = Qt;
1286 1286
1287 if ( 1287 if (FRAME_X_P (f)
1288 ?
1288#ifdef FRAME_EXTERNAL_MENU_BAR 1289#ifdef FRAME_EXTERNAL_MENU_BAR
1289 FRAME_EXTERNAL_MENU_BAR (f) 1290 FRAME_EXTERNAL_MENU_BAR (f)
1290#else 1291#else
1291 FRAME_MENU_BAR_LINES (f) > 0 1292 FRAME_MENU_BAR_LINES (f) > 0
1292#endif 1293#endif
1293 ) 1294 : FRAME_MENU_BAR_LINES (f) > 0)
1294 { 1295 {
1295 /* If the user has switched buffers or windows, we need to 1296 /* If the user has switched buffers or windows, we need to
1296 recompute to reflect the new bindings. But we'll 1297 recompute to reflect the new bindings. But we'll
@@ -1329,7 +1330,8 @@ update_menu_bar (f, save_match_data)
1329 call1 (Vrun_hooks, Qmenu_bar_update_hook); 1330 call1 (Vrun_hooks, Qmenu_bar_update_hook);
1330 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 1331 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
1331#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) 1332#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
1332 set_frame_menubar (f, 0, 0); 1333 if (FRAME_X_P (f))
1334 set_frame_menubar (f, 0, 0);
1333#endif /* USE_X_TOOLKIT || HAVE_NTGUI */ 1335#endif /* USE_X_TOOLKIT || HAVE_NTGUI */
1334 1336
1335 unbind_to (count, Qnil); 1337 unbind_to (count, Qnil);
@@ -1741,11 +1743,14 @@ done:
1741 1743
1742 /* When we reach a frame's selected window, redo the frame's menu bar. */ 1744 /* When we reach a frame's selected window, redo the frame's menu bar. */
1743 if (update_mode_line 1745 if (update_mode_line
1746 && (FRAME_X_P (f)
1747 ?
1744#ifdef FRAME_EXTERNAL_MENU_BAR 1748#ifdef FRAME_EXTERNAL_MENU_BAR
1745 && FRAME_EXTERNAL_MENU_BAR (f) 1749 FRAME_EXTERNAL_MENU_BAR (f)
1746#else 1750#else
1747 && FRAME_MENU_BAR_LINES (f) > 0 1751 FRAME_MENU_BAR_LINES (f) > 0
1748#endif 1752#endif
1753 : FRAME_MENU_BAR_LINES (f) > 0)
1749 && EQ (FRAME_SELECTED_WINDOW (f), window)) 1754 && EQ (FRAME_SELECTED_WINDOW (f), window))
1750 display_menu_bar (w); 1755 display_menu_bar (w);
1751 1756
@@ -1894,7 +1899,7 @@ try_window_id (window)
1894 struct position val, bp, ep, xp, pp; 1899 struct position val, bp, ep, xp, pp;
1895 int scroll_amount = 0; 1900 int scroll_amount = 0;
1896 int delta; 1901 int delta;
1897 int tab_offset, epto; 1902 int tab_offset, epto, old_tick;
1898 1903
1899 if (GPT - BEG < beg_unchanged) 1904 if (GPT - BEG < beg_unchanged)
1900 beg_unchanged = GPT - BEG; 1905 beg_unchanged = GPT - BEG;
@@ -2139,9 +2144,15 @@ try_window_id (window)
2139 to account for passing the line that that character really starts in. */ 2144 to account for passing the line that that character really starts in. */
2140 if (val.hpos < lmargin) 2145 if (val.hpos < lmargin)
2141 tab_offset += width; 2146 tab_offset += width;
2147 old_tick = MODIFF;
2142 while (vpos < stop_vpos) 2148 while (vpos < stop_vpos)
2143 { 2149 {
2144 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset); 2150 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset);
2151 /* If display_text_line ran a hook and changed some text,
2152 redisplay all the way to bottom of buffer
2153 So that we show the changes. */
2154 if (old_tick != MODIFF)
2155 stop_vpos = height;
2145 tab_offset += width; 2156 tab_offset += width;
2146 if (val.vpos) tab_offset = 0; 2157 if (val.vpos) tab_offset = 0;
2147 if (pos != val.bufpos) 2158 if (pos != val.bufpos)
@@ -2712,10 +2723,10 @@ display_text_line (w, start, vpos, hpos, taboffset)
2712 2723
2713 /* Figure out where (if at all) the 2724 /* Figure out where (if at all) the
2714 redisplay_end_trigger-hook should run. */ 2725 redisplay_end_trigger-hook should run. */
2715 if (MARKERP (current_buffer->redisplay_end_trigger)) 2726 if (MARKERP (w->redisplay_end_trigger))
2716 e_t_h = marker_position (current_buffer->redisplay_end_trigger); 2727 e_t_h = marker_position (w->redisplay_end_trigger);
2717 else if (INTEGERP (current_buffer->redisplay_end_trigger)) 2728 else if (INTEGERP (w->redisplay_end_trigger))
2718 e_t_h = XINT (current_buffer->redisplay_end_trigger); 2729 e_t_h = XINT (w->redisplay_end_trigger);
2719 else 2730 else
2720 e_t_h = ZV; 2731 e_t_h = ZV;
2721 2732
@@ -2723,8 +2734,8 @@ display_text_line (w, start, vpos, hpos, taboffset)
2723 run the hook. */ 2734 run the hook. */
2724 if (pos >= e_t_h && e_t_h != ZV) 2735 if (pos >= e_t_h && e_t_h != ZV)
2725 { 2736 {
2726 call1 (Vrun_hooks, Qredisplay_end_trigger_hook); 2737 Frun_hooks (1, &Qredisplay_end_trigger_hook);
2727 current_buffer->redisplay_end_trigger = Qnil; 2738 w->redisplay_end_trigger = Qnil;
2728 e_t_h = ZV; 2739 e_t_h = ZV;
2729 } 2740 }
2730 2741
@@ -3159,24 +3170,12 @@ display_menu_bar (w)
3159 int i; 3170 int i;
3160 3171
3161#if !defined (USE_X_TOOLKIT) && !defined (HAVE_NTGUI) 3172#if !defined (USE_X_TOOLKIT) && !defined (HAVE_NTGUI)
3162 if (FRAME_MENU_BAR_LINES (f) <= 0) 3173 if (FRAME_X_P (f))
3163 return; 3174 return;
3175#endif /* not USE_X_TOOLKIT and not HAVE_NTGUI */
3164 3176
3165 get_display_line (f, vpos, 0); 3177 get_display_line (f, vpos, 0);
3166 3178
3167#if 0
3168 /* Show in the menu bar how to invoke it. */
3169 if (!FRAME_X_P (f))
3170 {
3171 hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos,
3172 "M-`", 3,
3173 hpos, 0, 0, hpos, maxendcol);
3174 /* Put 2 spaces after it. */
3175 hpos = display_string (w, vpos, "", 0, hpos, 0, 0,
3176 hpos + 2, maxendcol);
3177 }
3178#endif
3179
3180 items = FRAME_MENU_BAR_ITEMS (f); 3179 items = FRAME_MENU_BAR_ITEMS (f);
3181 for (i = 0; i < XVECTOR (items)->size; i += 3) 3180 for (i = 0; i < XVECTOR (items)->size; i += 3)
3182 { 3181 {
@@ -3212,7 +3211,6 @@ display_menu_bar (w)
3212 vpos++; 3211 vpos++;
3213 while (vpos < FRAME_MENU_BAR_LINES (f)) 3212 while (vpos < FRAME_MENU_BAR_LINES (f))
3214 get_display_line (f, vpos++, 0); 3213 get_display_line (f, vpos++, 0);
3215#endif /* not USE_X_TOOLKIT && not HAVE_NTGUI */
3216} 3214}
3217 3215
3218/* Display the mode line for window w */ 3216/* Display the mode line for window w */
@@ -4007,6 +4005,7 @@ display_string (w, vpos, string, length, hpos, truncate,
4007 int mincol, maxcol; 4005 int mincol, maxcol;
4008{ 4006{
4009 register int c; 4007 register int c;
4008 int truncated;
4010 register GLYPH *p1; 4009 register GLYPH *p1;
4011 int hscroll = XINT (w->hscroll); 4010 int hscroll = XINT (w->hscroll);
4012 int tab_width = XINT (XBUFFER (w->buffer)->tab_width); 4011 int tab_width = XINT (XBUFFER (w->buffer)->tab_width);
@@ -4059,7 +4058,10 @@ display_string (w, vpos, string, length, hpos, truncate,
4059 if (maxcol >= 0 && mincol > maxcol) 4058 if (maxcol >= 0 && mincol > maxcol)
4060 mincol = maxcol; 4059 mincol = maxcol;
4061 4060
4062 while (p1 < end) 4061 /* We set truncated to 1 if we get stopped by trying to pass END
4062 (that is, trying to pass MAXCOL.) */
4063 truncated = 0;
4064 while (1)
4063 { 4065 {
4064 if (length == 0) 4066 if (length == 0)
4065 break; 4067 break;
@@ -4071,6 +4073,12 @@ display_string (w, vpos, string, length, hpos, truncate,
4071 else if (c == 0) 4073 else if (c == 0)
4072 break; 4074 break;
4073 4075
4076 if (p1 >= end)
4077 {
4078 truncated = 1;
4079 break;
4080 }
4081
4074 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) 4082 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
4075 { 4083 {
4076 p1 = copy_part_of_rope (f, p1, start, 4084 p1 = copy_part_of_rope (f, p1, start,
@@ -4124,7 +4132,7 @@ display_string (w, vpos, string, length, hpos, truncate,
4124 } 4132 }
4125 } 4133 }
4126 4134
4127 if (c && length > 0) 4135 if (truncated)
4128 { 4136 {
4129 p1 = end; 4137 p1 = end;
4130 if (truncate) *p1++ = fix_glyph (f, truncate, 0); 4138 if (truncate) *p1++ = fix_glyph (f, truncate, 0);