277
|
1 /* Display generation from window structure and buffer text.
|
10393
|
2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc.
|
277
|
3
|
|
4 This file is part of GNU Emacs.
|
|
5
|
|
6 GNU Emacs is free software; you can redistribute it and/or modify
|
|
7 it under the terms of the GNU General Public License as published by
|
1785
|
8 the Free Software Foundation; either version 2, or (at your option)
|
277
|
9 any later version.
|
|
10
|
|
11 GNU Emacs is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 GNU General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with GNU Emacs; see the file COPYING. If not, write to
|
14186
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
277
|
20
|
|
21
|
4696
|
22 #include <config.h>
|
277
|
23 #include <stdio.h>
|
|
24 /*#include <ctype.h>*/
|
|
25 #undef NULL
|
|
26 #include "lisp.h"
|
769
|
27 #include "frame.h"
|
277
|
28 #include "window.h"
|
|
29 #include "termchar.h"
|
|
30 #include "dispextern.h"
|
|
31 #include "buffer.h"
|
|
32 #include "indent.h"
|
|
33 #include "commands.h"
|
|
34 #include "macros.h"
|
|
35 #include "disptab.h"
|
1718
|
36 #include "termhooks.h"
|
4386
|
37 #include "intervals.h"
|
12081
|
38 #include "keyboard.h"
|
277
|
39
|
13419
|
40 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
|
5658
|
41 extern void set_frame_menubar ();
|
|
42 #endif
|
|
43
|
277
|
44 extern int interrupt_input;
|
|
45 extern int command_loop_level;
|
|
46
|
8471
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
47 extern Lisp_Object Qface;
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
48
|
12171
|
49 extern Lisp_Object Voverriding_local_map;
|
|
50 extern Lisp_Object Voverriding_local_map_menu_flag;
|
|
51
|
12263
|
52 Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
53 Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
|
13584
|
54 Lisp_Object Qredisplay_end_trigger_functions;
|
12171
|
55
|
10416
|
56 /* Nonzero means print newline to stdout before next minibuffer message. */
|
277
|
57
|
|
58 int noninteractive_need_newline;
|
|
59
|
10416
|
60 /* Nonzero means print newline to message log before next message. */
|
|
61
|
10567
|
62 static int message_log_need_newline;
|
10416
|
63
|
277
|
64 #define min(a, b) ((a) < (b) ? (a) : (b))
|
|
65 #define max(a, b) ((a) > (b) ? (a) : (b))
|
11810
|
66 #define minmax(floor, val, ceil) \
|
|
67 ((val) < (floor) ? (floor) : (val) > (ceil) ? (ceil) : (val))
|
277
|
68
|
|
69 /* The buffer position of the first character appearing
|
769
|
70 entirely or partially on the current frame line.
|
|
71 Or zero, which disables the optimization for the current frame line. */
|
277
|
72 static int this_line_bufpos;
|
|
73
|
|
74 /* Number of characters past the end of this line,
|
|
75 including the terminating newline */
|
|
76 static int this_line_endpos;
|
|
77
|
769
|
78 /* The vertical position of this frame line. */
|
277
|
79 static int this_line_vpos;
|
|
80
|
769
|
81 /* Hpos value for start of display on this frame line.
|
277
|
82 Usually zero, but negative if first character really began
|
|
83 on previous line */
|
|
84 static int this_line_start_hpos;
|
|
85
|
|
86 /* Buffer that this_line variables are describing. */
|
|
87 static struct buffer *this_line_buffer;
|
|
88
|
|
89 /* Value of echo_area_glyphs when it was last acted on.
|
769
|
90 If this is nonzero, there is a message on the frame
|
277
|
91 in the minibuffer and it should be erased as soon
|
|
92 as it is no longer requested to appear. */
|
|
93 char *previous_echo_glyphs;
|
|
94
|
769
|
95 /* Nonzero means truncate lines in all windows less wide than the frame */
|
277
|
96 int truncate_partial_width_windows;
|
|
97
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
98 /* Nonzero means we have more than one non-minibuffer-only frame.
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
99 Not guaranteed to be accurate except while parsing frame-title-format. */
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
100 int multiple_frames;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
101
|
277
|
102 Lisp_Object Vglobal_mode_string;
|
|
103
|
|
104 /* Marker for where to display an arrow on top of the buffer text. */
|
|
105 Lisp_Object Voverlay_arrow_position;
|
|
106
|
|
107 /* String to display for the arrow. */
|
|
108 Lisp_Object Voverlay_arrow_string;
|
|
109
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
110 /* Like mode-line-format, but for the titlebar on a visible frame. */
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
111 Lisp_Object Vframe_title_format;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
112
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
113 /* Like mode-line-format, but for the titlebar on an iconified frame. */
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
114 Lisp_Object Vicon_title_format;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
115
|
10667
|
116 /* List of functions to call when a window's size changes. These
|
|
117 functions get one arg, a frame on which one or more windows' sizes
|
|
118 have changed. */
|
|
119 static Lisp_Object Vwindow_size_change_functions;
|
|
120
|
277
|
121 /* Values of those variables at last redisplay. */
|
1527
|
122 static Lisp_Object last_arrow_position, last_arrow_string;
|
277
|
123
|
7096
|
124 Lisp_Object Qmenu_bar_update_hook;
|
|
125
|
277
|
126 /* Nonzero if overlay arrow has been displayed once in this window. */
|
|
127 static int overlay_arrow_seen;
|
|
128
|
11854
|
129 /* Nonzero if visible end of buffer has already been displayed once
|
|
130 in this window. (We need this variable in case there are overlay
|
|
131 strings that get displayed there.) */
|
|
132 static int zv_strings_seen;
|
|
133
|
3265
|
134 /* Nonzero means highlight the region even in nonselected windows. */
|
|
135 static int highlight_nonselected_windows;
|
|
136
|
769
|
137 /* If cursor motion alone moves point off frame,
|
277
|
138 Try scrolling this many lines up or down if that will bring it back. */
|
11719
|
139 static int scroll_step;
|
277
|
140
|
|
141 /* Nonzero if try_window_id has made blank lines at window bottom
|
|
142 since the last redisplay that paused */
|
|
143 static int blank_end_of_window;
|
|
144
|
10303
|
145 /* Number of windows showing the buffer of the selected window
|
|
146 (or another buffer with the same base buffer).
|
277
|
147 keyboard.c refers to this. */
|
|
148 int buffer_shared;
|
|
149
|
769
|
150 /* display_text_line sets these to the frame position (origin 0) of point,
|
277
|
151 whether the window is selected or not.
|
|
152 Set one to -1 first to determine whether point was found afterwards. */
|
|
153
|
|
154 static int cursor_vpos;
|
|
155 static int cursor_hpos;
|
|
156
|
11719
|
157 static int debug_end_pos;
|
277
|
158
|
|
159 /* Nonzero means display mode line highlighted */
|
|
160 int mode_line_inverse_video;
|
|
161
|
14662
|
162 static void redisplay_internal ();
|
10688
|
163 static int message_log_check_duplicate ();
|
277
|
164 static void echo_area_display ();
|
|
165 void mark_window_display_accurate ();
|
|
166 static void redisplay_windows ();
|
|
167 static void redisplay_window ();
|
5230
|
168 static void update_menu_bar ();
|
277
|
169 static void try_window ();
|
|
170 static int try_window_id ();
|
|
171 static struct position *display_text_line ();
|
|
172 static void display_mode_line ();
|
|
173 static int display_mode_element ();
|
|
174 static char *decode_mode_spec ();
|
|
175 static int display_string ();
|
2150
|
176 static void display_menu_bar ();
|
2303
|
177 static int display_count_lines ();
|
277
|
178
|
|
179 /* Prompt to display in front of the minibuffer contents */
|
7951
|
180 Lisp_Object minibuf_prompt;
|
277
|
181
|
|
182 /* Width in columns of current minibuffer prompt. */
|
|
183 int minibuf_prompt_width;
|
|
184
|
|
185 /* Message to display instead of minibuffer contents
|
|
186 This is what the functions error and message make,
|
|
187 and command echoing uses it as well.
|
|
188 It overrides the minibuf_prompt as well as the buffer. */
|
|
189 char *echo_area_glyphs;
|
|
190
|
5230
|
191 /* This is the length of the message in echo_area_glyphs. */
|
|
192 int echo_area_glyphs_length;
|
|
193
|
12629
|
194 /* This is the window where the echo area message was displayed.
|
|
195 It is always a minibuffer window, but it may not be the
|
|
196 same window currently active as a minibuffer. */
|
|
197 Lisp_Object echo_area_window;
|
|
198
|
277
|
199 /* true iff we should redraw the mode lines on the next redisplay */
|
|
200 int update_mode_lines;
|
|
201
|
|
202 /* Smallest number of characters before the gap
|
|
203 at any time since last redisplay that finished.
|
|
204 Valid for current buffer when try_window_id can be called. */
|
|
205 int beg_unchanged;
|
|
206
|
|
207 /* Smallest number of characters after the gap
|
|
208 at any time since last redisplay that finished.
|
|
209 Valid for current buffer when try_window_id can be called. */
|
|
210 int end_unchanged;
|
|
211
|
|
212 /* MODIFF as of last redisplay that finished;
|
|
213 if it matches MODIFF, beg_unchanged and end_unchanged
|
|
214 contain no useful information */
|
|
215 int unchanged_modified;
|
|
216
|
|
217 /* Nonzero if window sizes or contents have changed
|
|
218 since last redisplay that finished */
|
|
219 int windows_or_buffers_changed;
|
|
220
|
2303
|
221 /* Nonzero after display_mode_line if %l was used
|
|
222 and it displayed a line number. */
|
|
223 int line_number_displayed;
|
|
224
|
|
225 /* Maximum buffer size for which to display line numbers. */
|
11719
|
226 static int line_number_display_limit;
|
10393
|
227
|
|
228 /* Number of lines to keep in the message log buffer.
|
|
229 t means infinite. nil means don't log at all. */
|
|
230 Lisp_Object Vmessage_log_max;
|
277
|
231
|
14465
|
232 /* Output a newline in the *Messages* buffer if "needs" one. */
|
|
233
|
10567
|
234 void
|
|
235 message_log_maybe_newline ()
|
|
236 {
|
|
237 if (message_log_need_newline)
|
|
238 message_dolog ("", 0, 1);
|
|
239 }
|
|
240
|
|
241
|
10442
|
242 /* Add a string to the message log, optionally terminated with a newline.
|
|
243 This function calls low-level routines in order to bypass text property
|
|
244 hooks, etc. which might not be safe to run. */
|
5230
|
245
|
|
246 void
|
10416
|
247 message_dolog (m, len, nlflag)
|
5230
|
248 char *m;
|
10416
|
249 int len, nlflag;
|
5230
|
250 {
|
10416
|
251 if (!NILP (Vmessage_log_max))
|
10393
|
252 {
|
|
253 struct buffer *oldbuf;
|
|
254 int oldpoint, oldbegv, oldzv;
|
13733
|
255 int old_windows_or_buffers_changed = windows_or_buffers_changed;
|
10393
|
256
|
|
257 oldbuf = current_buffer;
|
10567
|
258 Fset_buffer (Fget_buffer_create (build_string ("*Messages*")));
|
11531
|
259 current_buffer->undo_list = Qt;
|
10393
|
260 oldpoint = PT;
|
|
261 oldbegv = BEGV;
|
|
262 oldzv = ZV;
|
10442
|
263 BEGV = BEG;
|
|
264 ZV = Z;
|
10393
|
265 if (oldpoint == Z)
|
10416
|
266 oldpoint += len + nlflag;
|
10393
|
267 if (oldzv == Z)
|
10416
|
268 oldzv += len + nlflag;
|
10393
|
269 TEMP_SET_PT (Z);
|
10416
|
270 if (len)
|
|
271 insert_1 (m, len, 1, 0);
|
|
272 if (nlflag)
|
10393
|
273 {
|
10688
|
274 int this_bol, prev_bol, dup;
|
|
275 insert_1 ("\n", 1, 1, 0);
|
|
276
|
|
277 this_bol = scan_buffer ('\n', Z, 0, -2, 0, 0);
|
|
278 if (this_bol > BEG)
|
|
279 {
|
|
280 prev_bol = scan_buffer ('\n', this_bol, 0, -2, 0, 0);
|
|
281 dup = message_log_check_duplicate (prev_bol, this_bol);
|
|
282 if (dup)
|
|
283 {
|
|
284 if (oldpoint > prev_bol)
|
|
285 oldpoint -= min (this_bol, oldpoint) - prev_bol;
|
|
286 if (oldbegv > prev_bol)
|
|
287 oldbegv -= min (this_bol, oldbegv) - prev_bol;
|
|
288 if (oldzv > prev_bol)
|
|
289 oldzv -= min (this_bol, oldzv) - prev_bol;
|
|
290 del_range_1 (prev_bol, this_bol, 0);
|
|
291 if (dup > 1)
|
|
292 {
|
|
293 char dupstr[40];
|
|
294 int duplen;
|
|
295
|
|
296 /* If you change this format, don't forget to also
|
|
297 change message_log_check_duplicate. */
|
|
298 sprintf (dupstr, " [%d times]", dup);
|
|
299 duplen = strlen (dupstr);
|
|
300 TEMP_SET_PT (Z-1);
|
|
301 if (oldpoint == Z)
|
|
302 oldpoint += duplen;
|
|
303 if (oldzv == Z)
|
|
304 oldzv += duplen;
|
|
305 insert_1 (dupstr, duplen, 1, 0);
|
|
306 }
|
|
307 }
|
|
308 }
|
|
309
|
|
310 if (NATNUMP (Vmessage_log_max))
|
|
311 {
|
|
312 int pos = scan_buffer ('\n', Z, 0,
|
|
313 -XFASTINT (Vmessage_log_max) - 1, 0, 0);
|
|
314 oldpoint -= min (pos, oldpoint) - BEG;
|
|
315 oldbegv -= min (pos, oldbegv) - BEG;
|
|
316 oldzv -= min (pos, oldzv) - BEG;
|
|
317 del_range_1 (BEG, pos, 0);
|
|
318 }
|
10393
|
319 }
|
|
320 BEGV = oldbegv;
|
|
321 ZV = oldzv;
|
|
322 TEMP_SET_PT (oldpoint);
|
|
323 set_buffer_internal (oldbuf);
|
13733
|
324 windows_or_buffers_changed = old_windows_or_buffers_changed;
|
10567
|
325 message_log_need_newline = !nlflag;
|
10393
|
326 }
|
10416
|
327 }
|
|
328
|
10688
|
329 /* We are at the end of the buffer after just having inserted a newline.
|
|
330 (Note: We depend on the fact we won't be crossing the gap.)
|
|
331 Check to see if the most recent message looks a lot like the previous one.
|
|
332 Return 0 if different, 1 if the new one should just replace it, or a
|
|
333 value N > 1 if we should also append " [N times]". */
|
11444
|
334
|
10688
|
335 static int
|
|
336 message_log_check_duplicate (prev_bol, this_bol)
|
|
337 int prev_bol, this_bol;
|
|
338 {
|
|
339 int i;
|
|
340 int len = Z - 1 - this_bol;
|
|
341 int seen_dots = 0;
|
11444
|
342 unsigned char *p1 = BUF_CHAR_ADDRESS (current_buffer, prev_bol);
|
|
343 unsigned char *p2 = BUF_CHAR_ADDRESS (current_buffer, this_bol);
|
10688
|
344
|
|
345 for (i = 0; i < len; i++)
|
|
346 {
|
|
347 if (i >= 3 && p1[i-3] == '.' && p1[i-2] == '.' && p1[i-1] == '.'
|
|
348 && p1[i] != '\n')
|
|
349 seen_dots = 1;
|
|
350 if (p1[i] != p2[i])
|
|
351 return seen_dots;
|
|
352 }
|
|
353 p1 += len;
|
|
354 if (*p1 == '\n')
|
|
355 return 2;
|
|
356 if (*p1++ == ' ' && *p1++ == '[')
|
|
357 {
|
|
358 int n = 0;
|
|
359 while (*p1 >= '0' && *p1 <= '9')
|
|
360 n = n * 10 + *p1++ - '0';
|
|
361 if (strncmp (p1, " times]\n", 8) == 0)
|
|
362 return n+1;
|
|
363 }
|
|
364 return 0;
|
|
365 }
|
14465
|
366
|
10416
|
367 /* Display an echo area message M with a specified length of LEN chars.
|
14465
|
368 The string may include null characters. If M is 0, clear out any
|
10416
|
369 existing message, and let the minibuffer text show through.
|
14465
|
370
|
|
371 The buffer M must continue to exist until after the echo area
|
|
372 gets cleared or some other message gets displayed there.
|
|
373
|
|
374 Do not pass text that is stored in a Lisp string.
|
|
375 Do not pass text in a buffer that was alloca'd. */
|
10416
|
376
|
|
377 void
|
|
378 message2 (m, len)
|
|
379 char *m;
|
|
380 int len;
|
|
381 {
|
|
382 /* First flush out any partial line written with print. */
|
10567
|
383 message_log_maybe_newline ();
|
10416
|
384 if (m)
|
|
385 message_dolog (m, len, 1);
|
10393
|
386 message2_nolog (m, len);
|
|
387 }
|
|
388
|
|
389
|
14465
|
390 /* The non-logging counterpart of message2. */
|
10393
|
391
|
|
392 void
|
|
393 message2_nolog (m, len)
|
|
394 char *m;
|
|
395 int len;
|
|
396 {
|
5230
|
397 if (noninteractive)
|
|
398 {
|
|
399 if (noninteractive_need_newline)
|
|
400 putc ('\n', stderr);
|
|
401 noninteractive_need_newline = 0;
|
|
402 fwrite (m, len, 1, stderr);
|
|
403 if (cursor_in_echo_area == 0)
|
|
404 fprintf (stderr, "\n");
|
|
405 fflush (stderr);
|
|
406 }
|
|
407 /* A null message buffer means that the frame hasn't really been
|
|
408 initialized yet. Error messages get reported properly by
|
|
409 cmd_error, so this must be just an informative message; toss it. */
|
|
410 else if (INTERACTIVE && FRAME_MESSAGE_BUF (selected_frame))
|
|
411 {
|
12629
|
412 Lisp_Object mini_window;
|
|
413 FRAME_PTR f;
|
|
414
|
|
415 /* Get the frame containing the minibuffer
|
|
416 that the selected frame is using. */
|
|
417 mini_window = FRAME_MINIBUF_WINDOW (selected_frame);
|
|
418 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
|
|
419
|
5230
|
420 #ifdef MULTI_FRAME
|
12629
|
421 FRAME_SAMPLE_VISIBILITY (f);
|
5230
|
422 if (FRAME_VISIBLE_P (selected_frame)
|
12629
|
423 && ! FRAME_VISIBLE_P (f))
|
|
424 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (mini_window)));
|
5230
|
425 #endif
|
|
426
|
|
427 if (m)
|
|
428 {
|
|
429 echo_area_glyphs = m;
|
|
430 echo_area_glyphs_length = len;
|
|
431 }
|
1527
|
432 else
|
|
433 echo_area_glyphs = previous_echo_glyphs = 0;
|
|
434
|
|
435 do_pending_window_change ();
|
|
436 echo_area_display ();
|
12629
|
437 update_frame (f, 1, 1);
|
1527
|
438 do_pending_window_change ();
|
6661
|
439 if (frame_up_to_date_hook != 0 && ! gc_in_progress)
|
12629
|
440 (*frame_up_to_date_hook) (f);
|
1527
|
441 }
|
|
442 }
|
14465
|
443
|
|
444 /* Display a null-terminated echo area message M. If M is 0, clear out any
|
|
445 existing message, and let the minibuffer text show through.
|
|
446
|
|
447 The buffer M must continue to exist until after the echo area
|
|
448 gets cleared or some other message gets displayed there.
|
|
449
|
|
450 Do not pass text that is stored in a Lisp string.
|
|
451 Do not pass text in a buffer that was alloca'd. */
|
1527
|
452
|
6366
|
453 void
|
|
454 message1 (m)
|
|
455 char *m;
|
|
456 {
|
|
457 message2 (m, (m ? strlen (m) : 0));
|
|
458 }
|
|
459
|
10394
|
460 void
|
|
461 message1_nolog (m)
|
|
462 char *m;
|
|
463 {
|
|
464 message2_nolog (m, (m ? strlen (m) : 0));
|
|
465 }
|
|
466
|
5658
|
467 /* Truncate what will be displayed in the echo area
|
|
468 the next time we display it--but don't redisplay it now. */
|
|
469
|
|
470 void
|
|
471 truncate_echo_area (len)
|
|
472 int len;
|
|
473 {
|
|
474 /* A null message buffer means that the frame hasn't really been
|
|
475 initialized yet. Error messages get reported properly by
|
|
476 cmd_error, so this must be just an informative message; toss it. */
|
|
477 if (!noninteractive && INTERACTIVE && FRAME_MESSAGE_BUF (selected_frame))
|
|
478 echo_area_glyphs_length = len;
|
|
479 }
|
|
480
|
769
|
481 /* Nonzero if FRAME_MESSAGE_BUF (selected_frame) is being used by print;
|
331
|
482 zero if being used by message. */
|
|
483 int message_buf_print;
|
|
484
|
14465
|
485 /* Dump an informative message to the minibuf. If M is 0, clear out
|
1446
|
486 any existing message, and let the minibuffer text show through. */
|
14465
|
487
|
277
|
488 /* VARARGS 1 */
|
|
489 void
|
|
490 message (m, a1, a2, a3)
|
|
491 char *m;
|
8834
|
492 EMACS_INT a1, a2, a3;
|
277
|
493 {
|
|
494 if (noninteractive)
|
|
495 {
|
1446
|
496 if (m)
|
|
497 {
|
|
498 if (noninteractive_need_newline)
|
|
499 putc ('\n', stderr);
|
|
500 noninteractive_need_newline = 0;
|
|
501 fprintf (stderr, m, a1, a2, a3);
|
2526
|
502 if (cursor_in_echo_area == 0)
|
|
503 fprintf (stderr, "\n");
|
1446
|
504 fflush (stderr);
|
|
505 }
|
277
|
506 }
|
1873
|
507 else if (INTERACTIVE)
|
277
|
508 {
|
1873
|
509 /* The frame whose minibuffer we're going to display the message on.
|
|
510 It may be larger than the selected frame, so we need
|
|
511 to use its buffer, not the selected frame's buffer. */
|
12629
|
512 Lisp_Object mini_window;
|
|
513 FRAME_PTR f;
|
|
514
|
|
515 /* Get the frame containing the minibuffer
|
|
516 that the selected frame is using. */
|
|
517 mini_window = FRAME_MINIBUF_WINDOW (selected_frame);
|
|
518 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
|
277
|
519
|
1873
|
520 /* A null message buffer means that the frame hasn't really been
|
|
521 initialized yet. Error messages get reported properly by
|
|
522 cmd_error, so this must be just an informative message; toss it. */
|
12629
|
523 if (FRAME_MESSAGE_BUF (f))
|
1873
|
524 {
|
|
525 if (m)
|
|
526 {
|
5230
|
527 int len;
|
1873
|
528 #ifdef NO_ARG_ARRAY
|
8834
|
529 EMACS_INT a[3];
|
5230
|
530 a[0] = a1;
|
|
531 a[1] = a2;
|
|
532 a[2] = a3;
|
|
533
|
12629
|
534 len = doprnt (FRAME_MESSAGE_BUF (f),
|
|
535 FRAME_WIDTH (f), m, (char *)0, 3, a);
|
1873
|
536 #else
|
12629
|
537 len = doprnt (FRAME_MESSAGE_BUF (f),
|
|
538 FRAME_WIDTH (f), m, (char *)0, 3, &a1);
|
1873
|
539 #endif /* NO_ARG_ARRAY */
|
5230
|
540
|
12629
|
541 message2 (FRAME_MESSAGE_BUF (f), len);
|
1873
|
542 }
|
|
543 else
|
|
544 message1 (0);
|
|
545
|
|
546 /* Print should start at the beginning of the message
|
|
547 buffer next time. */
|
|
548 message_buf_print = 0;
|
1446
|
549 }
|
277
|
550 }
|
|
551 }
|
|
552
|
14465
|
553 /* The non-logging version of message. */
|
11193
|
554 void
|
|
555 message_nolog (m, a1, a2, a3)
|
|
556 char *m;
|
|
557 EMACS_INT a1, a2, a3;
|
|
558 {
|
|
559 Lisp_Object old_log_max;
|
|
560 old_log_max = Vmessage_log_max;
|
|
561 Vmessage_log_max = Qnil;
|
|
562 message (m, a1, a2, a3);
|
|
563 Vmessage_log_max = old_log_max;
|
|
564 }
|
|
565
|
9088
|
566 void
|
|
567 update_echo_area ()
|
|
568 {
|
|
569 message2 (echo_area_glyphs, echo_area_glyphs_length);
|
|
570 }
|
14465
|
571
|
277
|
572 static void
|
|
573 echo_area_display ()
|
|
574 {
|
|
575 register int vpos;
|
769
|
576 FRAME_PTR f;
|
12629
|
577 Lisp_Object mini_window;
|
|
578
|
|
579 /* Choose the minibuffer window for this display.
|
|
580 It is the minibuffer window used by the selected frame. */
|
|
581 mini_window = FRAME_MINIBUF_WINDOW (selected_frame);
|
|
582 /* This is the frame that window is in. */
|
|
583 f = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
|
277
|
584
|
769
|
585 if (! FRAME_VISIBLE_P (f))
|
277
|
586 return;
|
|
587
|
769
|
588 if (frame_garbaged)
|
277
|
589 {
|
3516
|
590 redraw_garbaged_frames ();
|
769
|
591 frame_garbaged = 0;
|
277
|
592 }
|
|
593
|
|
594 if (echo_area_glyphs || minibuf_level == 0)
|
|
595 {
|
12629
|
596 echo_area_window = mini_window;
|
|
597
|
|
598 vpos = XFASTINT (XWINDOW (mini_window)->top);
|
769
|
599 get_display_line (f, vpos, 0);
|
12629
|
600 display_string (XWINDOW (mini_window), vpos,
|
277
|
601 echo_area_glyphs ? echo_area_glyphs : "",
|
5230
|
602 echo_area_glyphs ? echo_area_glyphs_length : -1,
|
5800
|
603 0, 0, 0, 0, FRAME_WIDTH (f));
|
277
|
604
|
12410
|
605 #if 0 /* This just gets in the way. update_frame does the job. */
|
277
|
606 /* If desired cursor location is on this line, put it at end of text */
|
11649
|
607 if (cursor_in_echo_area)
|
|
608 FRAME_CURSOR_Y (f) = vpos;
|
769
|
609 if (FRAME_CURSOR_Y (f) == vpos)
|
|
610 FRAME_CURSOR_X (f) = FRAME_DESIRED_GLYPHS (f)->used[vpos];
|
12410
|
611 #endif
|
727
|
612
|
|
613 /* Fill the rest of the minibuffer window with blank lines. */
|
|
614 {
|
|
615 int i;
|
|
616
|
3689
|
617 for (i = vpos + 1;
|
12629
|
618 i < vpos + XFASTINT (XWINDOW (mini_window)->height); i++)
|
727
|
619 {
|
769
|
620 get_display_line (f, i, 0);
|
12629
|
621 display_string (XWINDOW (mini_window), vpos,
|
5800
|
622 "", 0, 0, 0, 0, 0, FRAME_WIDTH (f));
|
727
|
623 }
|
|
624 }
|
277
|
625 }
|
12629
|
626 else if (!EQ (mini_window, selected_window))
|
277
|
627 windows_or_buffers_changed++;
|
|
628
|
12629
|
629 if (EQ (mini_window, selected_window))
|
277
|
630 this_line_bufpos = 0;
|
|
631
|
|
632 previous_echo_glyphs = echo_area_glyphs;
|
|
633 }
|
14465
|
634
|
|
635 /* Update frame titles. */
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
636
|
13419
|
637 #ifdef HAVE_WINDOW_SYSTEM
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
638 static char frame_title_buf[512];
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
639 static char *frame_title_ptr;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
640
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
641 static int
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
642 store_frame_title (str, mincol, maxcol)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
643 char *str;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
644 int mincol, maxcol;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
645 {
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
646 char *limit;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
647 if (maxcol < 0 || maxcol >= sizeof(frame_title_buf))
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
648 maxcol = sizeof (frame_title_buf);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
649 limit = &frame_title_buf[maxcol];
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
650 while (*str != '\0' && frame_title_ptr < limit)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
651 *frame_title_ptr++ = *str++;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
652 while (frame_title_ptr < &frame_title_buf[mincol])
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
653 *frame_title_ptr++ = ' ';
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
654 return frame_title_ptr - frame_title_buf;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
655 }
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
656
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
657 static void
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
658 x_consider_frame_title (frame)
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
659 Lisp_Object frame;
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
660 {
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
661 Lisp_Object fmt;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
662 struct buffer *obuf;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
663 int len;
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
664 FRAME_PTR f = XFRAME (frame);
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
665
|
13419
|
666 if (!(FRAME_WINDOW_P (f) || FRAME_MINIBUF_ONLY_P (f) || f->explicit_name))
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
667 return;
|
11767
|
668
|
|
669 /* Do we have more than one visible frame on this X display? */
|
|
670 {
|
|
671 Lisp_Object tail;
|
|
672
|
|
673 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
|
|
674 {
|
|
675 FRAME_PTR tf = XFRAME (XCONS (tail)->car);
|
|
676
|
11948
|
677 if (tf != f && FRAME_KBOARD (tf) == FRAME_KBOARD (f)
|
|
678 && !FRAME_MINIBUF_ONLY_P (tf)
|
11767
|
679 && (FRAME_VISIBLE_P (tf) || FRAME_ICONIFIED_P (tf)))
|
|
680 break;
|
|
681 }
|
|
682
|
|
683 multiple_frames = CONSP (tail);
|
|
684 }
|
|
685
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
686 obuf = current_buffer;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
687 Fset_buffer (XWINDOW (f->selected_window)->buffer);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
688 fmt = (FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
689 frame_title_ptr = frame_title_buf;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
690 len = display_mode_element (XWINDOW (f->selected_window), 0, 0, 0,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
691 0, sizeof (frame_title_buf), fmt);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
692 frame_title_ptr = 0;
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
693 set_buffer_internal (obuf);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
694 /* Set the name only if it's changed. This avoids consing
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
695 in the common case where it hasn't. (If it turns out that we've
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
696 already wasted too much time by walking through the list with
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
697 display_mode_element, then we might need to optimize at a higher
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
698 level than this.) */
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
699 if (! STRINGP (f->name) || XSTRING (f->name)->size != len
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
700 || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
701 x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil);
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
702 }
|
8783
|
703 #else
|
|
704 #define frame_title_ptr ((char *)0)
|
8918
|
705 #define store_frame_title(str, mincol, maxcol) 0
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
706 #endif
|
277
|
707
|
5230
|
708 /* Prepare for redisplay by updating menu-bar item lists when appropriate.
|
11499
|
709 This can call eval. */
|
5230
|
710
|
|
711 void
|
|
712 prepare_menu_bars ()
|
|
713 {
|
|
714 register struct window *w = XWINDOW (selected_window);
|
|
715 int all_windows;
|
10667
|
716 struct gcpro gcpro1, gcpro2;
|
5230
|
717
|
6872
|
718 all_windows = (update_mode_lines || buffer_shared > 1
|
12472
|
719 || windows_or_buffers_changed);
|
5230
|
720
|
11920
|
721 /* Update all frame titles based on their buffer names, etc.
|
|
722 We do this before the menu bars so that the buffer-menu
|
|
723 will show the up-to-date frame titles.
|
|
724
|
|
725 This used to be done after the menu bars, for a reason that
|
|
726 was stated as follows but which I do not understand:
|
|
727 "We do this after the menu bars so that the frame will first
|
|
728 create its menu bar using the name `emacs' if no other name
|
|
729 has yet been specified."
|
|
730 I think that is no longer a concern. */
|
13419
|
731 #ifdef HAVE_WINDOW_SYSTEM
|
13826
|
732 if (windows_or_buffers_changed || update_mode_lines)
|
11920
|
733 {
|
|
734 Lisp_Object tail, frame;
|
|
735
|
|
736 FOR_EACH_FRAME (tail, frame)
|
|
737 if (FRAME_VISIBLE_P (XFRAME (frame))
|
|
738 || FRAME_ICONIFIED_P (XFRAME (frame)))
|
|
739 x_consider_frame_title (frame);
|
|
740 }
|
|
741 #endif
|
|
742
|
5230
|
743 /* Update the menu bar item lists, if appropriate.
|
|
744 This has to be done before any actual redisplay
|
|
745 or generation of display lines. */
|
|
746 if (all_windows)
|
|
747 {
|
|
748 Lisp_Object tail, frame;
|
11761
|
749 int count = specpdl_ptr - specpdl;
|
|
750
|
|
751 record_unwind_protect (Fstore_match_data, Fmatch_data ());
|
5230
|
752
|
|
753 FOR_EACH_FRAME (tail, frame)
|
10667
|
754 {
|
|
755 /* If a window on this frame changed size,
|
|
756 report that to the user and clear the size-change flag. */
|
|
757 if (FRAME_WINDOW_SIZES_CHANGED (XFRAME (frame)))
|
|
758 {
|
|
759 Lisp_Object functions;
|
11719
|
760 /* Clear flag first in case we get error below. */
|
|
761 FRAME_WINDOW_SIZES_CHANGED (XFRAME (frame)) = 0;
|
10667
|
762 functions = Vwindow_size_change_functions;
|
|
763 GCPRO2 (tail, functions);
|
|
764 while (CONSP (functions))
|
|
765 {
|
|
766 call1 (XCONS (functions)->car, frame);
|
|
767 functions = XCONS (functions)->cdr;
|
|
768 }
|
|
769 UNGCPRO;
|
|
770 }
|
|
771 GCPRO1 (tail);
|
11761
|
772 update_menu_bar (XFRAME (frame), 0);
|
10667
|
773 UNGCPRO;
|
|
774 }
|
11761
|
775
|
|
776 unbind_to (count, Qnil);
|
5230
|
777 }
|
6872
|
778 else
|
11761
|
779 update_menu_bar (selected_frame, 1);
|
5230
|
780 }
|
|
781
|
769
|
782 /* Do a frame update, taking possible shortcuts into account.
|
277
|
783 This is the main external entry point for redisplay.
|
|
784
|
|
785 If the last redisplay displayed an echo area message and that
|
|
786 message is no longer requested, we clear the echo area
|
|
787 or bring back the minibuffer if that is in use.
|
|
788
|
5230
|
789 Do not call eval from within this function.
|
|
790 Calls to eval after the call to echo_area_display would confuse
|
|
791 the display_line mechanism and would cause a crash.
|
|
792 Calls to eval before that point will work most of the time,
|
|
793 but can still lose, because this function
|
|
794 can be called from signal handlers; with alarms set up;
|
277
|
795 or with synchronous processes running.
|
5230
|
796
|
277
|
797 See Fcall_process; if you called it from here, it could be
|
|
798 entered recursively. */
|
|
799
|
6650
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
800 static int do_verify_charstarts;
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
801
|
9530
|
802 /* Counter is used to clear the face cache
|
|
803 no more than once ever 1000 redisplays. */
|
|
804 static int clear_face_cache_count;
|
|
805
|
12765
|
806 /* Record the previous terminal frame we displayed. */
|
|
807 static FRAME_PTR previous_terminal_frame;
|
|
808
|
277
|
809 void
|
|
810 redisplay ()
|
|
811 {
|
14662
|
812 redisplay_internal (0);
|
|
813 }
|
|
814
|
|
815 /* If PRESERVE_ECHO_AREA is nonzero, it means this redisplay
|
|
816 is not in response to any user action; therefore, we should
|
14683
|
817 preserve the echo area. (Actually, our caller does that job.)
|
|
818 Perhaps in the future avoid recentering windows
|
14662
|
819 if it is not necessary; currently that causes some problems. */
|
|
820
|
|
821 static void
|
|
822 redisplay_internal (preserve_echo_area)
|
|
823 int preserve_echo_area;
|
|
824 {
|
277
|
825 register struct window *w = XWINDOW (selected_window);
|
|
826 register int pause;
|
|
827 int must_finish = 0;
|
|
828 int all_windows;
|
|
829 register int tlbufpos, tlendpos;
|
|
830 struct position pos;
|
|
831
|
|
832 if (noninteractive)
|
|
833 return;
|
|
834
|
14559
|
835 #ifdef USE_X_TOOLKIT
|
|
836 if (popup_activated ())
|
|
837 return;
|
|
838 #endif
|
|
839
|
12765
|
840 #ifdef MULTI_FRAME
|
|
841 if (FRAME_TERMCAP_P (selected_frame)
|
|
842 && previous_terminal_frame != selected_frame)
|
|
843 {
|
|
844 /* Since frames on an ASCII terminal share the same display area,
|
|
845 displaying a different frame means redisplay the whole thing. */
|
|
846 windows_or_buffers_changed++;
|
|
847 SET_FRAME_GARBAGED (selected_frame);
|
|
848 XSETFRAME (Vterminal_frame, selected_frame);
|
|
849 }
|
|
850 previous_terminal_frame = selected_frame;
|
|
851 #endif
|
|
852
|
1656
|
853 /* Set the visible flags for all frames.
|
|
854 Do this before checking for resized or garbaged frames; they want
|
|
855 to know if their frames are visible.
|
|
856 See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */
|
|
857 {
|
2252
|
858 Lisp_Object tail, frame;
|
1656
|
859
|
2252
|
860 FOR_EACH_FRAME (tail, frame)
|
11444
|
861 {
|
|
862 FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
|
|
863
|
|
864 /* Clear out all the display lines in which we will generate the
|
|
865 glyphs to display. */
|
|
866 init_desired_glyphs (XFRAME (frame));
|
|
867 }
|
1656
|
868 }
|
|
869
|
769
|
870 /* Notice any pending interrupt request to change frame size. */
|
277
|
871 do_pending_window_change ();
|
|
872
|
769
|
873 if (frame_garbaged)
|
277
|
874 {
|
3516
|
875 redraw_garbaged_frames ();
|
769
|
876 frame_garbaged = 0;
|
277
|
877 }
|
|
878
|
11444
|
879 prepare_menu_bars ();
|
|
880
|
12472
|
881 if (windows_or_buffers_changed)
|
277
|
882 update_mode_lines++;
|
|
883
|
|
884 /* Detect case that we need to write a star in the mode line. */
|
|
885 if (XFASTINT (w->last_modified) < MODIFF
|
10303
|
886 && XFASTINT (w->last_modified) <= SAVE_MODIFF)
|
277
|
887 {
|
|
888 w->update_mode_line = Qt;
|
|
889 if (buffer_shared > 1)
|
|
890 update_mode_lines++;
|
|
891 }
|
|
892
|
12472
|
893 /* If %c is in use, update it if needed. */
|
|
894 if (!NILP (w->column_number_displayed)
|
|
895 /* This alternative quickly identifies a common case
|
|
896 where no change is needed. */
|
|
897 && !(PT == XFASTINT (w->last_point)
|
|
898 && XFASTINT (w->last_modified) >= MODIFF)
|
|
899 && XFASTINT (w->column_number_displayed) != current_column ())
|
|
900 w->update_mode_line = Qt;
|
|
901
|
769
|
902 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1;
|
277
|
903
|
|
904 all_windows = update_mode_lines || buffer_shared > 1;
|
|
905
|
|
906 /* If specs for an arrow have changed, do thorough redisplay
|
|
907 to ensure we remove any arrow that should no longer exist. */
|
1527
|
908 if (! EQ (Voverlay_arrow_position, last_arrow_position)
|
|
909 || ! EQ (Voverlay_arrow_string, last_arrow_string))
|
12472
|
910 all_windows = 1;
|
277
|
911
|
5230
|
912 /* Normally the message* functions will have already displayed and
|
|
913 updated the echo area, but the frame may have been trashed, or
|
|
914 the update may have been preempted, so display the echo area
|
|
915 again here. */
|
|
916 if (echo_area_glyphs || previous_echo_glyphs)
|
|
917 {
|
|
918 echo_area_display ();
|
|
919 must_finish = 1;
|
|
920 }
|
|
921
|
2848
|
922 /* If showing region, and mark has changed, must redisplay whole window. */
|
|
923 if (((!NILP (Vtransient_mark_mode)
|
|
924 && !NILP (XBUFFER (w->buffer)->mark_active))
|
|
925 != !NILP (w->region_showing))
|
3937
|
926 || (!NILP (w->region_showing)
|
|
927 && !EQ (w->region_showing,
|
|
928 Fmarker_position (XBUFFER (w->buffer)->mark))))
|
2848
|
929 this_line_bufpos = -1;
|
|
930
|
277
|
931 tlbufpos = this_line_bufpos;
|
|
932 tlendpos = this_line_endpos;
|
485
|
933 if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line)
|
12629
|
934 && !current_buffer->clip_changed
|
769
|
935 && FRAME_VISIBLE_P (XFRAME (w->frame))
|
277
|
936 /* Make sure recorded data applies to current buffer, etc */
|
|
937 && this_line_buffer == current_buffer
|
|
938 && current_buffer == XBUFFER (w->buffer)
|
485
|
939 && NILP (w->force_start)
|
277
|
940 /* Point must be on the line that we have info recorded about */
|
6705
|
941 && PT >= tlbufpos
|
|
942 && PT <= Z - tlendpos
|
277
|
943 /* All text outside that line, including its final newline,
|
|
944 must be unchanged */
|
|
945 && (XFASTINT (w->last_modified) >= MODIFF
|
|
946 || (beg_unchanged >= tlbufpos - 1
|
|
947 && GPT >= tlbufpos
|
528
|
948 /* If selective display, can't optimize
|
|
949 if the changes start at the beginning of the line. */
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
950 && ((INTEGERP (current_buffer->selective_display)
|
528
|
951 && XINT (current_buffer->selective_display) > 0
|
|
952 ? (beg_unchanged >= tlbufpos
|
|
953 && GPT > tlbufpos)
|
|
954 : 1))
|
277
|
955 && end_unchanged >= tlendpos
|
|
956 && Z - GPT >= tlendpos)))
|
|
957 {
|
|
958 if (tlbufpos > BEGV && FETCH_CHAR (tlbufpos - 1) != '\n'
|
|
959 && (tlbufpos == ZV
|
|
960 || FETCH_CHAR (tlbufpos) == '\n'))
|
|
961 /* Former continuation line has disappeared by becoming empty */
|
|
962 goto cancel;
|
|
963 else if (XFASTINT (w->last_modified) < MODIFF
|
|
964 || MINI_WINDOW_P (w))
|
|
965 {
|
|
966 cursor_vpos = -1;
|
|
967 overlay_arrow_seen = 0;
|
11854
|
968 zv_strings_seen = 0;
|
277
|
969 display_text_line (w, tlbufpos, this_line_vpos, this_line_start_hpos,
|
|
970 pos_tab_offset (w, tlbufpos));
|
|
971 /* If line contains point, is not continued,
|
|
972 and ends at same distance from eob as before, we win */
|
|
973 if (cursor_vpos >= 0 && this_line_bufpos
|
|
974 && this_line_endpos == tlendpos)
|
|
975 {
|
6650
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
976 /* If this is not the window's last line,
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
977 we must adjust the charstarts of the lines below. */
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
978 if (this_line_vpos + 1
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
979 < XFASTINT (w->top) + window_internal_height (w))
|
6643
|
980 {
|
|
981 int left = XFASTINT (w->left);
|
|
982 int *charstart_next_line
|
|
983 = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1];
|
|
984 int adjust;
|
|
985
|
|
986 if (Z - tlendpos == ZV)
|
|
987 /* This line ends at end of (accessible part of) buffer.
|
|
988 There is no newline to count. */
|
|
989 adjust = Z - tlendpos - charstart_next_line[left];
|
|
990 else
|
|
991 /* This line ends in a newline.
|
|
992 Must take account of the newline and the rest of the
|
|
993 text that follows. */
|
|
994 adjust = Z - tlendpos + 1 - charstart_next_line[left];
|
|
995
|
|
996 adjust_window_charstarts (w, this_line_vpos, adjust);
|
|
997 }
|
6619
|
998
|
769
|
999 if (XFASTINT (w->width) != FRAME_WIDTH (XFRAME (WINDOW_FRAME (w))))
|
277
|
1000 preserve_other_columns (w);
|
|
1001 goto update;
|
|
1002 }
|
|
1003 else
|
|
1004 goto cancel;
|
|
1005 }
|
12410
|
1006 else if (PT == XFASTINT (w->last_point)
|
|
1007 /* Make sure the cursor was last displayed
|
|
1008 in this window. Otherwise we have to reposition it. */
|
|
1009 && XINT (w->top) <= FRAME_CURSOR_Y (selected_frame)
|
|
1010 && (XINT (w->top) + XINT (w->height)
|
|
1011 > FRAME_CURSOR_Y (selected_frame)))
|
277
|
1012 {
|
|
1013 if (!must_finish)
|
|
1014 {
|
|
1015 do_pending_window_change ();
|
|
1016 return;
|
|
1017 }
|
|
1018 goto update;
|
|
1019 }
|
11641
|
1020 /* If highlighting the region, or if the cursor is in the echo area,
|
|
1021 then we can't just move the cursor. */
|
2848
|
1022 else if (! (!NILP (Vtransient_mark_mode)
|
|
1023 && !NILP (current_buffer->mark_active))
|
11641
|
1024 && NILP (w->region_showing)
|
|
1025 && !cursor_in_echo_area)
|
277
|
1026 {
|
|
1027 pos = *compute_motion (tlbufpos, 0,
|
|
1028 XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0,
|
11854
|
1029 0,
|
13363
|
1030 PT, 2, - (1 << (BITS_PER_SHORT - 1)),
|
1785
|
1031 window_internal_width (w) - 1,
|
574
|
1032 XINT (w->hscroll),
|
6692
|
1033 pos_tab_offset (w, tlbufpos), w);
|
277
|
1034 if (pos.vpos < 1)
|
|
1035 {
|
11810
|
1036 int width = window_internal_width (w) - 1;
|
769
|
1037 FRAME_CURSOR_X (selected_frame)
|
11810
|
1038 = XFASTINT (w->left) + minmax (0, pos.hpos, width);
|
769
|
1039 FRAME_CURSOR_Y (selected_frame) = this_line_vpos;
|
277
|
1040 goto update;
|
|
1041 }
|
|
1042 else
|
|
1043 goto cancel;
|
|
1044 }
|
|
1045 cancel:
|
|
1046 /* Text changed drastically or point moved off of line */
|
769
|
1047 cancel_line (this_line_vpos, selected_frame);
|
277
|
1048 }
|
|
1049
|
|
1050 this_line_bufpos = 0;
|
|
1051 all_windows |= buffer_shared > 1;
|
|
1052
|
9530
|
1053 clear_face_cache_count++;
|
|
1054
|
277
|
1055 if (all_windows)
|
|
1056 {
|
2252
|
1057 Lisp_Object tail, frame;
|
277
|
1058
|
9572
|
1059 #ifdef HAVE_FACES
|
9530
|
1060 /* Clear the face cache, only when we do a full redisplay
|
|
1061 and not too often either. */
|
|
1062 if (clear_face_cache_count > 1000)
|
|
1063 {
|
|
1064 clear_face_cache ();
|
|
1065 clear_face_cache_count = 0;
|
|
1066 }
|
2729
|
1067 #endif
|
|
1068
|
277
|
1069 /* Recompute # windows showing selected buffer.
|
433
|
1070 This will be incremented each time such a window is displayed. */
|
277
|
1071 buffer_shared = 0;
|
|
1072
|
2252
|
1073 FOR_EACH_FRAME (tail, frame)
|
1718
|
1074 {
|
2252
|
1075 FRAME_PTR f = XFRAME (frame);
|
10769
|
1076 if (! FRAME_TERMCAP_P (f) || f == selected_frame)
|
|
1077 {
|
|
1078
|
|
1079 /* Mark all the scroll bars to be removed; we'll redeem the ones
|
|
1080 we want when we redisplay their windows. */
|
|
1081 if (condemn_scroll_bars_hook)
|
|
1082 (*condemn_scroll_bars_hook) (f);
|
|
1083
|
|
1084 if (FRAME_VISIBLE_P (f))
|
14662
|
1085 redisplay_windows (FRAME_ROOT_WINDOW (f), preserve_echo_area);
|
10769
|
1086
|
|
1087 /* Any scroll bars which redisplay_windows should have nuked
|
|
1088 should now go away. */
|
|
1089 if (judge_scroll_bars_hook)
|
|
1090 (*judge_scroll_bars_hook) (f);
|
|
1091 }
|
1718
|
1092 }
|
277
|
1093 }
|
769
|
1094 else if (FRAME_VISIBLE_P (selected_frame))
|
277
|
1095 {
|
14662
|
1096 redisplay_window (selected_window, 1, preserve_echo_area);
|
769
|
1097 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame))
|
277
|
1098 preserve_other_columns (w);
|
|
1099 }
|
|
1100
|
|
1101 update:
|
|
1102 /* Prevent various kinds of signals during display update.
|
|
1103 stdio is not robust about handling signals,
|
|
1104 which can cause an apparent I/O error. */
|
|
1105 if (interrupt_input)
|
|
1106 unrequest_sigio ();
|
|
1107 stop_polling ();
|
|
1108
|
769
|
1109 #ifdef MULTI_FRAME
|
277
|
1110 if (all_windows)
|
|
1111 {
|
|
1112 Lisp_Object tail;
|
|
1113
|
|
1114 pause = 0;
|
|
1115
|
769
|
1116 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
|
277
|
1117 {
|
769
|
1118 FRAME_PTR f;
|
277
|
1119
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1120 if (!FRAMEP (XCONS (tail)->car))
|
277
|
1121 continue;
|
|
1122
|
769
|
1123 f = XFRAME (XCONS (tail)->car);
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1124
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1125 if ((! FRAME_TERMCAP_P (f) || f == selected_frame)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1126 && FRAME_VISIBLE_P (f))
|
277
|
1127 {
|
769
|
1128 pause |= update_frame (f, 0, 0);
|
277
|
1129 if (!pause)
|
6612
|
1130 {
|
|
1131 mark_window_display_accurate (f->root_window, 1);
|
|
1132 if (frame_up_to_date_hook != 0)
|
|
1133 (*frame_up_to_date_hook) (f);
|
|
1134 }
|
277
|
1135 }
|
|
1136 }
|
|
1137 }
|
|
1138 else
|
769
|
1139 #endif /* MULTI_FRAME */
|
368
|
1140 {
|
769
|
1141 if (FRAME_VISIBLE_P (selected_frame))
|
|
1142 pause = update_frame (selected_frame, 0, 0);
|
11108
|
1143 else
|
|
1144 pause = 0;
|
1656
|
1145
|
433
|
1146 /* We may have called echo_area_display at the top of this
|
769
|
1147 function. If the echo area is on another frame, that may
|
|
1148 have put text on a frame other than the selected one, so the
|
|
1149 above call to update_frame would not have caught it. Catch
|
433
|
1150 it here. */
|
|
1151 {
|
12792
937154a9dfbe
(redisplay): Compute mini_frame the same way echo_area_display does.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1152 Lisp_Object mini_window;
|
937154a9dfbe
(redisplay): Compute mini_frame the same way echo_area_display does.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1153 FRAME_PTR mini_frame;
|
937154a9dfbe
(redisplay): Compute mini_frame the same way echo_area_display does.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1154
|
937154a9dfbe
(redisplay): Compute mini_frame the same way echo_area_display does.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1155 mini_window = FRAME_MINIBUF_WINDOW (selected_frame);
|
937154a9dfbe
(redisplay): Compute mini_frame the same way echo_area_display does.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1156 mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
|
433
|
1157
|
12765
|
1158 if (mini_frame != selected_frame
|
|
1159 && ! FRAME_TERMCAP_P (mini_frame))
|
769
|
1160 pause |= update_frame (mini_frame, 0, 0);
|
433
|
1161 }
|
368
|
1162 }
|
277
|
1163
|
769
|
1164 /* If frame does not match, prevent doing single-line-update next time.
|
277
|
1165 Also, don't forget to check every line to update the arrow. */
|
|
1166 if (pause)
|
|
1167 {
|
|
1168 this_line_bufpos = 0;
|
485
|
1169 if (!NILP (last_arrow_position))
|
277
|
1170 {
|
|
1171 last_arrow_position = Qt;
|
|
1172 last_arrow_string = Qt;
|
|
1173 }
|
769
|
1174 /* If we pause after scrolling, some lines in current_frame
|
277
|
1175 may be null, so preserve_other_columns won't be able to
|
|
1176 preserve all the vertical-bar separators. So, avoid using it
|
|
1177 in that case. */
|
769
|
1178 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame))
|
277
|
1179 update_mode_lines = 1;
|
|
1180 }
|
|
1181
|
769
|
1182 /* Now text on frame agrees with windows, so
|
277
|
1183 put info into the windows for partial redisplay to follow */
|
|
1184
|
|
1185 if (!pause)
|
|
1186 {
|
|
1187 register struct buffer *b = XBUFFER (w->buffer);
|
|
1188
|
|
1189 blank_end_of_window = 0;
|
|
1190 unchanged_modified = BUF_MODIFF (b);
|
|
1191 beg_unchanged = BUF_GPT (b) - BUF_BEG (b);
|
|
1192 end_unchanged = BUF_Z (b) - BUF_GPT (b);
|
|
1193
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1194 XSETFASTINT (w->last_point, BUF_PT (b));
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1195 XSETFASTINT (w->last_point_x, FRAME_CURSOR_X (selected_frame));
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1196 XSETFASTINT (w->last_point_y, FRAME_CURSOR_Y (selected_frame));
|
277
|
1197
|
|
1198 if (all_windows)
|
1017
|
1199 mark_window_display_accurate (FRAME_ROOT_WINDOW (selected_frame), 1);
|
277
|
1200 else
|
|
1201 {
|
12472
|
1202 b->clip_changed = 0;
|
277
|
1203 w->update_mode_line = Qnil;
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1204 XSETFASTINT (w->last_modified, BUF_MODIFF (b));
|
6684
|
1205 w->window_end_valid = w->buffer;
|
277
|
1206 last_arrow_position = Voverlay_arrow_position;
|
|
1207 last_arrow_string = Voverlay_arrow_string;
|
6650
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1208 if (do_verify_charstarts)
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1209 verify_charstarts (w);
|
6612
|
1210 if (frame_up_to_date_hook != 0)
|
|
1211 (*frame_up_to_date_hook) (selected_frame);
|
277
|
1212 }
|
|
1213 update_mode_lines = 0;
|
|
1214 windows_or_buffers_changed = 0;
|
|
1215 }
|
|
1216
|
|
1217 /* Start SIGIO interrupts coming again.
|
|
1218 Having them off during the code above
|
|
1219 makes it less likely one will discard output,
|
|
1220 but not impossible, since there might be stuff
|
|
1221 in the system buffer here.
|
|
1222 But it is much hairier to try to do anything about that. */
|
|
1223
|
|
1224 if (interrupt_input)
|
|
1225 request_sigio ();
|
|
1226 start_polling ();
|
|
1227
|
769
|
1228 /* Change frame size now if a change is pending. */
|
277
|
1229 do_pending_window_change ();
|
7752
|
1230
|
|
1231 /* If we just did a pending size change, redisplay again
|
|
1232 for the new size. */
|
7757
|
1233 if (windows_or_buffers_changed && !pause)
|
7752
|
1234 redisplay ();
|
277
|
1235 }
|
|
1236
|
|
1237 /* Redisplay, but leave alone any recent echo area message
|
|
1238 unless another message has been requested in its place.
|
|
1239
|
|
1240 This is useful in situations where you need to redisplay but no
|
|
1241 user action has occurred, making it inappropriate for the message
|
|
1242 area to be cleared. See tracking_off and
|
|
1243 wait_reading_process_input for examples of these situations. */
|
|
1244
|
|
1245 redisplay_preserve_echo_area ()
|
|
1246 {
|
|
1247 if (echo_area_glyphs == 0 && previous_echo_glyphs != 0)
|
|
1248 {
|
|
1249 echo_area_glyphs = previous_echo_glyphs;
|
14662
|
1250 redisplay_internal (1);
|
277
|
1251 echo_area_glyphs = 0;
|
|
1252 }
|
|
1253 else
|
14662
|
1254 redisplay_internal (1);
|
277
|
1255 }
|
|
1256
|
|
1257 void
|
|
1258 mark_window_display_accurate (window, flag)
|
|
1259 Lisp_Object window;
|
|
1260 int flag;
|
|
1261 {
|
|
1262 register struct window *w;
|
|
1263
|
485
|
1264 for (;!NILP (window); window = w->next)
|
277
|
1265 {
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1266 if (!WINDOWP (window)) abort ();
|
277
|
1267 w = XWINDOW (window);
|
|
1268
|
485
|
1269 if (!NILP (w->buffer))
|
2848
|
1270 {
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1271 XSETFASTINT (w->last_modified,
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1272 !flag ? 0 : BUF_MODIFF (XBUFFER (w->buffer)));
|
2848
|
1273
|
|
1274 /* Record if we are showing a region, so can make sure to
|
|
1275 update it fully at next redisplay. */
|
|
1276 w->region_showing = (!NILP (Vtransient_mark_mode)
|
|
1277 && !NILP (XBUFFER (w->buffer)->mark_active)
|
|
1278 ? Fmarker_position (XBUFFER (w->buffer)->mark)
|
|
1279 : Qnil);
|
|
1280 }
|
|
1281
|
6684
|
1282 w->window_end_valid = w->buffer;
|
277
|
1283 w->update_mode_line = Qnil;
|
14263
|
1284 if (!NILP (w->buffer) && flag)
|
12472
|
1285 XBUFFER (w->buffer)->clip_changed = 0;
|
277
|
1286
|
485
|
1287 if (!NILP (w->vchild))
|
277
|
1288 mark_window_display_accurate (w->vchild, flag);
|
485
|
1289 if (!NILP (w->hchild))
|
277
|
1290 mark_window_display_accurate (w->hchild, flag);
|
|
1291 }
|
|
1292
|
|
1293 if (flag)
|
|
1294 {
|
|
1295 last_arrow_position = Voverlay_arrow_position;
|
|
1296 last_arrow_string = Voverlay_arrow_string;
|
|
1297 }
|
|
1298 else
|
|
1299 {
|
|
1300 /* t is unequal to any useful value of Voverlay_arrow_... */
|
|
1301 last_arrow_position = Qt;
|
|
1302 last_arrow_string = Qt;
|
|
1303 }
|
|
1304 }
|
|
1305
|
6872
|
1306 /* Update the menu bar item list for frame F.
|
5230
|
1307 This has to be done before we start to fill in any display lines,
|
11761
|
1308 because it can call eval.
|
|
1309
|
|
1310 If SAVE_MATCH_DATA is 1, we must save and restore it here. */
|
5230
|
1311
|
|
1312 static void
|
11761
|
1313 update_menu_bar (f, save_match_data)
|
6872
|
1314 FRAME_PTR f;
|
11761
|
1315 int save_match_data;
|
5230
|
1316 {
|
|
1317 struct buffer *old = current_buffer;
|
6872
|
1318 Lisp_Object window;
|
|
1319 register struct window *w;
|
11761
|
1320
|
6872
|
1321 window = FRAME_SELECTED_WINDOW (f);
|
|
1322 w = XWINDOW (window);
|
5230
|
1323
|
|
1324 if (update_mode_lines)
|
|
1325 w->update_mode_line = Qt;
|
|
1326
|
14265
9bc9be522a4d
(update_menu__ba, redisplay_window) :" Use FRAME_WINDOW_P
Geoff Voelker <voelker@cs.washington.edu>
diff
changeset
|
1327 if (FRAME_WINDOW_P (f)
|
13459
|
1328 ?
|
13511
|
1329 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
|
7096
|
1330 FRAME_EXTERNAL_MENU_BAR (f)
|
5676
b5027523c90d
Wed Jan 26 12:23:12 1994 Frederic Pierresteguy (fp@mole.gnu.ai.mit.edu)
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
diff
changeset
|
1331 #else
|
7096
|
1332 FRAME_MENU_BAR_LINES (f) > 0
|
5676
b5027523c90d
Wed Jan 26 12:23:12 1994 Frederic Pierresteguy (fp@mole.gnu.ai.mit.edu)
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
diff
changeset
|
1333 #endif
|
13459
|
1334 : FRAME_MENU_BAR_LINES (f) > 0)
|
5230
|
1335 {
|
|
1336 /* If the user has switched buffers or windows, we need to
|
|
1337 recompute to reflect the new bindings. But we'll
|
|
1338 recompute when update_mode_lines is set too; that means
|
|
1339 that people can use force-mode-line-update to request
|
|
1340 that the menu bar be recomputed. The adverse effect on
|
|
1341 the rest of the redisplay algorithm is about the same as
|
|
1342 windows_or_buffers_changed anyway. */
|
|
1343 if (windows_or_buffers_changed
|
7096
|
1344 || !NILP (w->update_mode_line)
|
5230
|
1345 || (XFASTINT (w->last_modified) < MODIFF
|
|
1346 && (XFASTINT (w->last_modified)
|
12022
|
1347 <= BUF_SAVE_MODIFF (XBUFFER (w->buffer))))
|
|
1348 || ((!NILP (Vtransient_mark_mode)
|
|
1349 && !NILP (XBUFFER (w->buffer)->mark_active))
|
|
1350 != !NILP (w->region_showing)))
|
5230
|
1351 {
|
|
1352 struct buffer *prev = current_buffer;
|
11761
|
1353 int count = specpdl_ptr - specpdl;
|
|
1354
|
12171
|
1355 set_buffer_internal_1 (XBUFFER (w->buffer));
|
12017
|
1356 if (save_match_data)
|
11761
|
1357 record_unwind_protect (Fstore_match_data, Fmatch_data ());
|
12171
|
1358 if (NILP (Voverriding_local_map_menu_flag))
|
12263
|
1359 {
|
|
1360 specbind (Qoverriding_terminal_local_map, Qnil);
|
|
1361 specbind (Qoverriding_local_map, Qnil);
|
|
1362 }
|
11761
|
1363
|
12141
|
1364 /* Run the Lucid hook. */
|
|
1365 call1 (Vrun_hooks, Qactivate_menubar_hook);
|
|
1366 /* If it has changed current-menubar from previous value,
|
|
1367 really recompute the menubar from the value. */
|
|
1368 if (! NILP (Vlucid_menu_bar_dirty_flag))
|
|
1369 call0 (Qrecompute_lucid_menubar);
|
14299
|
1370 safe_run_hooks (Qmenu_bar_update_hook);
|
6134
|
1371 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
|
13419
|
1372 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
|
14265
9bc9be522a4d
(update_menu__ba, redisplay_window) :" Use FRAME_WINDOW_P
Geoff Voelker <voelker@cs.washington.edu>
diff
changeset
|
1373 if (FRAME_WINDOW_P (f))
|
13459
|
1374 set_frame_menubar (f, 0, 0);
|
13419
|
1375 #endif /* USE_X_TOOLKIT || HAVE_NTGUI */
|
11761
|
1376
|
|
1377 unbind_to (count, Qnil);
|
12171
|
1378 set_buffer_internal_1 (prev);
|
5230
|
1379 }
|
|
1380 }
|
|
1381 }
|
|
1382
|
277
|
1383 int do_id = 1;
|
|
1384
|
5230
|
1385 /* Redisplay WINDOW and its subwindows and siblings. */
|
|
1386
|
277
|
1387 static void
|
14662
|
1388 redisplay_windows (window, preserve_echo_area)
|
277
|
1389 Lisp_Object window;
|
14662
|
1390 int preserve_echo_area;
|
277
|
1391 {
|
485
|
1392 for (; !NILP (window); window = XWINDOW (window)->next)
|
14662
|
1393 redisplay_window (window, 0, preserve_echo_area);
|
277
|
1394 }
|
|
1395
|
5230
|
1396 /* Redisplay window WINDOW and its subwindows. */
|
|
1397
|
277
|
1398 static void
|
14662
|
1399 redisplay_window (window, just_this_one, preserve_echo_area)
|
277
|
1400 Lisp_Object window;
|
14662
|
1401 int just_this_one, preserve_echo_area;
|
277
|
1402 {
|
|
1403 register struct window *w = XWINDOW (window);
|
1718
|
1404 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
|
277
|
1405 int height;
|
6705
|
1406 register int lpoint = PT;
|
277
|
1407 struct buffer *old = current_buffer;
|
1785
|
1408 register int width = window_internal_width (w) - 1;
|
277
|
1409 register int startp;
|
|
1410 register int hscroll = XINT (w->hscroll);
|
|
1411 struct position pos;
|
6705
|
1412 int opoint = PT;
|
277
|
1413 int tem;
|
10764
|
1414 int update_mode_line;
|
13188
|
1415 struct Lisp_Char_Table *dp = window_display_table (w);
|
277
|
1416
|
769
|
1417 if (FRAME_HEIGHT (f) == 0) abort (); /* Some bug zeros some core */
|
277
|
1418
|
|
1419 /* If this is a combination window, do its children; that's all. */
|
|
1420
|
485
|
1421 if (!NILP (w->vchild))
|
277
|
1422 {
|
14682
|
1423 redisplay_windows (w->vchild, preserve_echo_area);
|
277
|
1424 return;
|
|
1425 }
|
485
|
1426 if (!NILP (w->hchild))
|
277
|
1427 {
|
14682
|
1428 redisplay_windows (w->hchild, preserve_echo_area);
|
277
|
1429 return;
|
|
1430 }
|
485
|
1431 if (NILP (w->buffer))
|
277
|
1432 abort ();
|
433
|
1433
|
|
1434 height = window_internal_height (w);
|
11108
|
1435 update_mode_line = (!NILP (w->update_mode_line) || update_mode_lines);
|
12629
|
1436 if (XBUFFER (w->buffer)->clip_changed)
|
|
1437 update_mode_line = 1;
|
433
|
1438
|
|
1439 if (MINI_WINDOW_P (w))
|
|
1440 {
|
12629
|
1441 if (w == XWINDOW (echo_area_window) && echo_area_glyphs)
|
|
1442 /* We've already displayed the echo area glyphs in this window. */
|
|
1443 goto finish_scroll_bars;
|
|
1444 else if (w != XWINDOW (minibuf_window))
|
433
|
1445 {
|
12629
|
1446 /* This is a minibuffer, but it's not the currently active one,
|
|
1447 so clear it. */
|
|
1448 int vpos = XFASTINT (w->top);
|
433
|
1449 int i;
|
|
1450
|
|
1451 for (i = 0; i < height; i++)
|
|
1452 {
|
769
|
1453 get_display_line (f, vpos + i, 0);
|
5800
|
1454 display_string (w, vpos + i, "", 0, 0, 0, 1, 0, width);
|
433
|
1455 }
|
|
1456
|
1992
|
1457 goto finish_scroll_bars;
|
433
|
1458 }
|
|
1459 }
|
277
|
1460
|
|
1461 /* Otherwise set up data on this window; select its buffer and point value */
|
|
1462
|
10764
|
1463 if (update_mode_line)
|
11888
|
1464 set_buffer_internal_1 (XBUFFER (w->buffer));
|
10764
|
1465 else
|
|
1466 set_buffer_temp (XBUFFER (w->buffer));
|
|
1467
|
6705
|
1468 opoint = PT;
|
277
|
1469
|
12472
|
1470 /* If %c is in mode line, update it if needed. */
|
|
1471 if (!NILP (w->column_number_displayed)
|
|
1472 /* This alternative quickly identifies a common case
|
|
1473 where no change is needed. */
|
|
1474 && !(PT == XFASTINT (w->last_point)
|
|
1475 && XFASTINT (w->last_modified) >= MODIFF)
|
|
1476 && XFASTINT (w->column_number_displayed) != current_column ())
|
|
1477 update_mode_line = 1;
|
|
1478
|
10303
|
1479 /* Count number of windows showing the selected buffer.
|
|
1480 An indirect buffer counts as its base buffer. */
|
|
1481
|
|
1482 if (!just_this_one)
|
|
1483 {
|
|
1484 struct buffer *current_base, *window_base;
|
|
1485 current_base = current_buffer;
|
|
1486 window_base = XBUFFER (XWINDOW (selected_window)->buffer);
|
|
1487 if (current_base->base_buffer)
|
|
1488 current_base = current_base->base_buffer;
|
|
1489 if (window_base->base_buffer)
|
|
1490 window_base = window_base->base_buffer;
|
|
1491 if (current_base == window_base)
|
|
1492 buffer_shared++;
|
|
1493 }
|
277
|
1494
|
|
1495 /* POINT refers normally to the selected window.
|
|
1496 For any other window, set up appropriate value. */
|
|
1497
|
|
1498 if (!EQ (window, selected_window))
|
|
1499 {
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1500 int new_pt = marker_position (w->pointm);
|
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1501 if (new_pt < BEGV)
|
277
|
1502 {
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1503 new_pt = BEGV;
|
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1504 Fset_marker (w->pointm, make_number (new_pt), Qnil);
|
277
|
1505 }
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1506 else if (new_pt > (ZV - 1))
|
277
|
1507 {
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1508 new_pt = ZV;
|
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1509 Fset_marker (w->pointm, make_number (new_pt), Qnil);
|
277
|
1510 }
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1511 /* We don't use SET_PT so that the point-motion hooks don't run. */
|
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1512 BUF_PT (current_buffer) = new_pt;
|
277
|
1513 }
|
|
1514
|
9412
|
1515 /* If any of the character widths specified in the display table
|
|
1516 have changed, invalidate the width run cache. It's true that this
|
|
1517 may be a bit late to catch such changes, but the rest of
|
|
1518 redisplay goes (non-fatally) haywire when the display table is
|
|
1519 changed, so why should we worry about doing any better? */
|
|
1520 if (current_buffer->width_run_cache)
|
|
1521 {
|
13188
|
1522 struct Lisp_Char_Table *disptab = buffer_display_table ();
|
9412
|
1523
|
|
1524 if (! disptab_matches_widthtab (disptab,
|
|
1525 XVECTOR (current_buffer->width_table)))
|
|
1526 {
|
|
1527 invalidate_region_cache (current_buffer,
|
|
1528 current_buffer->width_run_cache,
|
|
1529 BEG, Z);
|
|
1530 recompute_width_table (current_buffer, disptab);
|
|
1531 }
|
|
1532 }
|
|
1533
|
277
|
1534 /* If window-start is screwed up, choose a new one. */
|
|
1535 if (XMARKER (w->start)->buffer != current_buffer)
|
|
1536 goto recenter;
|
|
1537
|
|
1538 startp = marker_position (w->start);
|
|
1539
|
433
|
1540 /* Handle case where place to start displaying has been specified,
|
2303
|
1541 unless the specified location is outside the accessible range. */
|
485
|
1542 if (!NILP (w->force_start))
|
277
|
1543 {
|
13833
|
1544 w->force_start = Qnil;
|
2303
|
1545 /* Forget any recorded base line for line number display. */
|
|
1546 w->base_line_number = Qnil;
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1547 /* Redisplay the mode line. Select the buffer properly for that.
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1548 Also, run the hook window-scroll-functions
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1549 because we have scrolled. */
|
13833
|
1550 /* Note, we do this after clearing force_start because
|
|
1551 if there's an error, it is better to forget about force_start
|
|
1552 than to get into an infinite loop calling the hook functions
|
|
1553 and having them get more errors. */
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1554 if (!update_mode_line
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1555 || ! NILP (Vwindow_scroll_functions))
|
10764
|
1556 {
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1557 Lisp_Object temp[3];
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1558
|
10764
|
1559 set_buffer_temp (old);
|
11888
|
1560 set_buffer_internal_1 (XBUFFER (w->buffer));
|
10764
|
1561 update_mode_line = 1;
|
|
1562 w->update_mode_line = Qt;
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1563 if (! NILP (Vwindow_scroll_functions))
|
14614
|
1564 {
|
|
1565 run_hook_with_args_2 (Qwindow_scroll_functions, window,
|
|
1566 make_number (startp));
|
|
1567 startp = marker_position (w->start);
|
|
1568 }
|
10764
|
1569 }
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1570 XSETFASTINT (w->last_modified, 0);
|
433
|
1571 if (startp < BEGV) startp = BEGV;
|
|
1572 if (startp > ZV) startp = ZV;
|
277
|
1573 try_window (window, startp);
|
|
1574 if (cursor_vpos < 0)
|
|
1575 {
|
|
1576 /* If point does not appear, move point so it does appear */
|
|
1577 pos = *compute_motion (startp, 0,
|
11854
|
1578 (((EQ (window, minibuf_window)
|
|
1579 && startp == BEG)
|
|
1580 ? minibuf_prompt_width : 0)
|
|
1581 + (hscroll ? 1 - hscroll : 0)),
|
|
1582 0,
|
|
1583 ZV, height / 2,
|
13363
|
1584 - (1 << (BITS_PER_SHORT - 1)),
|
11854
|
1585 width, hscroll, pos_tab_offset (w, startp), w);
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1586 BUF_PT (current_buffer) = pos.bufpos;
|
5230
|
1587 if (w != XWINDOW (selected_window))
|
6705
|
1588 Fset_marker (w->pointm, make_number (PT), Qnil);
|
277
|
1589 else
|
|
1590 {
|
5340
|
1591 if (current_buffer == old)
|
6705
|
1592 lpoint = PT;
|
11810
|
1593 FRAME_CURSOR_X (f) = (XFASTINT (w->left)
|
|
1594 + minmax (0, pos.hpos, width));
|
769
|
1595 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top);
|
277
|
1596 }
|
9218
|
1597 /* If we are highlighting the region,
|
|
1598 then we just changed the region, so redisplay to show it. */
|
|
1599 if (!NILP (Vtransient_mark_mode)
|
|
1600 && !NILP (current_buffer->mark_active))
|
9420
|
1601 {
|
|
1602 cancel_my_columns (XWINDOW (window));
|
|
1603 try_window (window, startp);
|
|
1604 }
|
277
|
1605 }
|
|
1606 goto done;
|
|
1607 }
|
|
1608
|
|
1609 /* Handle case where text has not changed, only point,
|
14178
|
1610 and it has not moved off the frame. */
|
277
|
1611
|
|
1612 /* This code is not used for minibuffer for the sake of
|
|
1613 the case of redisplaying to replace an echo area message;
|
|
1614 since in that case the minibuffer contents per se are usually unchanged.
|
|
1615 This code is of no real use in the minibuffer since
|
|
1616 the handling of this_line_bufpos, etc.,
|
|
1617 in redisplay handles the same cases. */
|
|
1618
|
|
1619 if (XFASTINT (w->last_modified) >= MODIFF
|
12493
|
1620 && PT >= startp && !current_buffer->clip_changed
|
769
|
1621 && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f))
|
11085
|
1622 /* If force-mode-line-update was called, really redisplay;
|
|
1623 that's how redisplay is forced after e.g. changing
|
|
1624 buffer-invisibility-spec. */
|
11111
|
1625 && NILP (w->update_mode_line)
|
2848
|
1626 /* Can't use this case if highlighting a region. */
|
|
1627 && !(!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
|
|
1628 && NILP (w->region_showing)
|
7927
e02087efad68
(redisplay_window): Don't use shortcut if window_end_vpos is out of date.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1629 /* If end pos is out of date, scroll bar and percentage will be wrong */
|
e02087efad68
(redisplay_window): Don't use shortcut if window_end_vpos is out of date.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1630 && INTEGERP (w->window_end_vpos)
|
e02087efad68
(redisplay_window): Don't use shortcut if window_end_vpos is out of date.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1631 && XFASTINT (w->window_end_vpos) < XFASTINT (w->height)
|
277
|
1632 && !EQ (window, minibuf_window))
|
|
1633 {
|
11854
|
1634 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), 0,
|
11111
|
1635 PT, height, 0, width, hscroll,
|
6692
|
1636 pos_tab_offset (w, startp), w);
|
277
|
1637
|
|
1638 if (pos.vpos < height)
|
|
1639 {
|
769
|
1640 /* Ok, point is still on frame */
|
|
1641 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
|
277
|
1642 {
|
|
1643 /* These variables are supposed to be origin 1 */
|
11810
|
1644 FRAME_CURSOR_X (f) = (XFASTINT (w->left)
|
|
1645 + minmax (0, pos.hpos, width));
|
769
|
1646 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top);
|
277
|
1647 }
|
|
1648 /* This doesn't do the trick, because if a window to the right of
|
|
1649 this one must be redisplayed, this does nothing because there
|
769
|
1650 is nothing in DesiredFrame yet, and then the other window is
|
277
|
1651 redisplayed, making likes that are empty in this window's columns.
|
769
|
1652 if (XFASTINT (w->width) != FRAME_WIDTH (f))
|
277
|
1653 preserve_my_columns (w);
|
|
1654 */
|
|
1655 goto done;
|
|
1656 }
|
|
1657 /* Don't bother trying redisplay with same start;
|
|
1658 we already know it will lose */
|
|
1659 }
|
|
1660 /* If current starting point was originally the beginning of a line
|
|
1661 but no longer is, find a new starting point. */
|
485
|
1662 else if (!NILP (w->start_at_line_beg)
|
8594
|
1663 && !(startp <= BEGV
|
277
|
1664 || FETCH_CHAR (startp - 1) == '\n'))
|
|
1665 {
|
|
1666 goto recenter;
|
|
1667 }
|
|
1668 else if (just_this_one && !MINI_WINDOW_P (w)
|
6705
|
1669 && PT >= startp
|
277
|
1670 && XFASTINT (w->last_modified)
|
3648
|
1671 /* or else vmotion on first line won't work. */
|
|
1672 && ! NILP (w->start_at_line_beg)
|
277
|
1673 && ! EQ (w->window_end_valid, Qnil)
|
12493
|
1674 && do_id && !current_buffer->clip_changed
|
277
|
1675 && !blank_end_of_window
|
769
|
1676 && XFASTINT (w->width) == FRAME_WIDTH (f)
|
2848
|
1677 /* Can't use this case if highlighting a region. */
|
|
1678 && !(!NILP (Vtransient_mark_mode)
|
|
1679 && !NILP (current_buffer->mark_active))
|
11971
|
1680 /* Don't use try_window_id if newline
|
|
1681 doesn't display as the end of a line. */
|
|
1682 && !(dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, '\n')))
|
2848
|
1683 && NILP (w->region_showing)
|
277
|
1684 && EQ (last_arrow_position, Voverlay_arrow_position)
|
|
1685 && EQ (last_arrow_string, Voverlay_arrow_string)
|
769
|
1686 && (tem = try_window_id (FRAME_SELECTED_WINDOW (f)))
|
277
|
1687 && tem != -2)
|
|
1688 {
|
|
1689 /* tem > 0 means success. tem == -1 means choose new start.
|
|
1690 tem == -2 means try again with same start,
|
|
1691 and nothing but whitespace follows the changed stuff.
|
|
1692 tem == 0 means try again with same start. */
|
|
1693 if (tem > 0)
|
|
1694 goto done;
|
|
1695 }
|
|
1696 else if (startp >= BEGV && startp <= ZV
|
14662
|
1697 && (startp < ZV
|
|
1698 /* Avoid starting at end of buffer. */
|
|
1699 #if 0 /* This change causes trouble for M-! finger & RET.
|
|
1700 It will have to be considered later. */
|
|
1701 || ! EQ (window, selected_window)
|
|
1702 /* Don't do the recentering if redisplay
|
|
1703 is not for no user action. */
|
|
1704 || preserve_echo_area
|
|
1705 #endif
|
|
1706 || startp == BEGV
|
277
|
1707 || (XFASTINT (w->last_modified) >= MODIFF)))
|
|
1708 {
|
|
1709 /* Try to redisplay starting at same place as before */
|
769
|
1710 /* If point has not moved off frame, accept the results */
|
277
|
1711 try_window (window, startp);
|
|
1712 if (cursor_vpos >= 0)
|
2303
|
1713 {
|
12472
|
1714 if (!just_this_one || current_buffer->clip_changed
|
|
1715 || beg_unchanged < startp)
|
2303
|
1716 /* Forget any recorded base line for line number display. */
|
|
1717 w->base_line_number = Qnil;
|
|
1718 goto done;
|
|
1719 }
|
277
|
1720 else
|
|
1721 cancel_my_columns (w);
|
|
1722 }
|
|
1723
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1724 XSETFASTINT (w->last_modified, 0);
|
10764
|
1725 /* Redisplay the mode line. Select the buffer properly for that. */
|
|
1726 if (!update_mode_line)
|
|
1727 {
|
|
1728 set_buffer_temp (old);
|
11888
|
1729 set_buffer_internal_1 (XBUFFER (w->buffer));
|
10764
|
1730 update_mode_line = 1;
|
|
1731 w->update_mode_line = Qt;
|
|
1732 }
|
277
|
1733
|
|
1734 /* Try to scroll by specified few lines */
|
|
1735
|
13760
|
1736 if (scroll_step && !current_buffer->clip_changed
|
|
1737 && startp >= BEGV && startp <= ZV)
|
277
|
1738 {
|
6705
|
1739 if (PT > startp)
|
277
|
1740 {
|
11810
|
1741 pos = *vmotion (Z - XFASTINT (w->window_end_pos), scroll_step, w);
|
277
|
1742 if (pos.vpos >= height)
|
|
1743 goto scroll_fail;
|
|
1744 }
|
|
1745
|
11810
|
1746 pos = *vmotion (startp, (PT < startp ? - scroll_step : scroll_step), w);
|
277
|
1747
|
6705
|
1748 if (PT >= pos.bufpos)
|
277
|
1749 {
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1750 if (! NILP (Vwindow_scroll_functions))
|
14614
|
1751 {
|
14988
|
1752 Fset_marker (w->start, make_number (pos.bufpos), Qnil);
|
14614
|
1753 run_hook_with_args_2 (Qwindow_scroll_functions, window,
|
|
1754 make_number (pos.bufpos));
|
|
1755 pos.bufpos = marker_position (w->start);
|
|
1756 }
|
277
|
1757 try_window (window, pos.bufpos);
|
|
1758 if (cursor_vpos >= 0)
|
2303
|
1759 {
|
12472
|
1760 if (!just_this_one || current_buffer->clip_changed
|
|
1761 || beg_unchanged < startp)
|
2303
|
1762 /* Forget any recorded base line for line number display. */
|
|
1763 w->base_line_number = Qnil;
|
|
1764 goto done;
|
|
1765 }
|
277
|
1766 else
|
|
1767 cancel_my_columns (w);
|
|
1768 }
|
|
1769 scroll_fail: ;
|
|
1770 }
|
|
1771
|
|
1772 /* Finally, just choose place to start which centers point */
|
|
1773
|
|
1774 recenter:
|
2303
|
1775 /* Forget any previously recorded base line for line number display. */
|
|
1776 w->base_line_number = Qnil;
|
|
1777
|
11810
|
1778 pos = *vmotion (PT, - (height / 2), w);
|
13833
|
1779 /* Set startp here explicitly in case that helps avoid an infinite loop
|
|
1780 in case the window-scroll-functions functions get errors. */
|
14178
|
1781 Fset_marker (w->start, make_number (pos.bufpos), Qnil);
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1782 if (! NILP (Vwindow_scroll_functions))
|
14614
|
1783 {
|
|
1784 run_hook_with_args_2 (Qwindow_scroll_functions, window,
|
|
1785 make_number (pos.bufpos));
|
|
1786 pos.bufpos = marker_position (w->start);
|
|
1787 }
|
277
|
1788 try_window (window, pos.bufpos);
|
|
1789
|
|
1790 startp = marker_position (w->start);
|
11854
|
1791 w->start_at_line_beg
|
8594
|
1792 = (startp == BEGV || FETCH_CHAR (startp - 1) == '\n') ? Qt : Qnil;
|
277
|
1793
|
|
1794 done:
|
10764
|
1795 if ((update_mode_line
|
2303
|
1796 /* If window not full width, must redo its mode line
|
|
1797 if the window to its side is being redone */
|
|
1798 || (!just_this_one && width < FRAME_WIDTH (f) - 1)
|
10441
f1fc7b6e5fa4
(redisplay, redisplay_window, display_mode_line, decode_mode_spec): Use window
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1799 || INTEGERP (w->base_line_pos)
|
f1fc7b6e5fa4
(redisplay, redisplay_window, display_mode_line, decode_mode_spec): Use window
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1800 || (!NILP (w->column_number_displayed)
|
f1fc7b6e5fa4
(redisplay, redisplay_window, display_mode_line, decode_mode_spec): Use window
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1801 && XFASTINT (w->column_number_displayed) != current_column ()))
|
277
|
1802 && height != XFASTINT (w->height))
|
|
1803 display_mode_line (w);
|
2303
|
1804 if (! line_number_displayed
|
|
1805 && ! BUFFERP (w->base_line_pos))
|
|
1806 {
|
|
1807 w->base_line_pos = Qnil;
|
|
1808 w->base_line_number = Qnil;
|
|
1809 }
|
277
|
1810
|
2150
|
1811 /* When we reach a frame's selected window, redo the frame's menu bar. */
|
10764
|
1812 if (update_mode_line
|
14265
9bc9be522a4d
(update_menu__ba, redisplay_window) :" Use FRAME_WINDOW_P
Geoff Voelker <voelker@cs.washington.edu>
diff
changeset
|
1813 && (FRAME_WINDOW_P (f)
|
13459
|
1814 ?
|
13511
|
1815 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
|
13459
|
1816 FRAME_EXTERNAL_MENU_BAR (f)
|
5658
|
1817 #else
|
13459
|
1818 FRAME_MENU_BAR_LINES (f) > 0
|
5658
|
1819 #endif
|
13459
|
1820 : FRAME_MENU_BAR_LINES (f) > 0)
|
2150
|
1821 && EQ (FRAME_SELECTED_WINDOW (f), window))
|
|
1822 display_menu_bar (w);
|
|
1823
|
1992
|
1824 finish_scroll_bars:
|
|
1825 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
|
1785
|
1826 {
|
|
1827 int start, end, whole;
|
|
1828
|
|
1829 /* Calculate the start and end positions for the current window.
|
2874
|
1830 At some point, it would be nice to choose between scrollbars
|
|
1831 which reflect the whole buffer size, with special markers
|
|
1832 indicating narrowing, and scrollbars which reflect only the
|
|
1833 visible region.
|
|
1834
|
1785
|
1835 Note that minibuffers sometimes aren't displaying any text. */
|
|
1836 if (! MINI_WINDOW_P (w)
|
|
1837 || (w == XWINDOW (minibuf_window) && ! echo_area_glyphs))
|
|
1838 {
|
2929
f3c44426bed2
Fix the fix to scrollbar computaaFix the fix to the fix for scrollbar computation.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
1839 whole = ZV - BEGV;
|
11108
|
1840 start = marker_position (w->start) - BEGV;
|
1785
|
1841 /* I don't think this is guaranteed to be right. For the
|
|
1842 moment, we'll pretend it is. */
|
3880
|
1843 end = (Z - XINT (w->window_end_pos)) - BEGV;
|
2874
|
1844
|
|
1845 if (end < start) end = start;
|
2929
f3c44426bed2
Fix the fix to scrollbar computaaFix the fix to the fix for scrollbar computation.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
1846 if (whole < (end - start)) whole = end - start;
|
1785
|
1847 }
|
|
1848 else
|
|
1849 start = end = whole = 0;
|
|
1850
|
1992
|
1851 /* Indicate what this scroll bar ought to be displaying now. */
|
3788
|
1852 (*set_vertical_scroll_bar_hook) (w, end - start, whole, start);
|
1785
|
1853
|
1992
|
1854 /* Note that we actually used the scroll bar attached to this window,
|
1785
|
1855 so it shouldn't be deleted at the end of redisplay. */
|
1992
|
1856 (*redeem_scroll_bar_hook) (w);
|
1785
|
1857 }
|
|
1858
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1859 BUF_PT (current_buffer) = opoint;
|
10764
|
1860 if (update_mode_line)
|
11888
|
1861 set_buffer_internal_1 (old);
|
10764
|
1862 else
|
|
1863 set_buffer_temp (old);
|
8417
3f2854a14982
(redisplay_window): Avoid using SET_PT to change point temporarily.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
1864 BUF_PT (current_buffer) = lpoint;
|
277
|
1865 }
|
|
1866
|
|
1867 /* Do full redisplay on one window, starting at position `pos'. */
|
|
1868
|
|
1869 static void
|
|
1870 try_window (window, pos)
|
|
1871 Lisp_Object window;
|
|
1872 register int pos;
|
|
1873 {
|
|
1874 register struct window *w = XWINDOW (window);
|
|
1875 register int height = window_internal_height (w);
|
|
1876 register int vpos = XFASTINT (w->top);
|
|
1877 register int last_text_vpos = vpos;
|
|
1878 int tab_offset = pos_tab_offset (w, pos);
|
769
|
1879 FRAME_PTR f = XFRAME (w->frame);
|
1785
|
1880 int width = window_internal_width (w) - 1;
|
277
|
1881 struct position val;
|
|
1882
|
|
1883 Fset_marker (w->start, make_number (pos), Qnil);
|
|
1884 cursor_vpos = -1;
|
|
1885 overlay_arrow_seen = 0;
|
11854
|
1886 zv_strings_seen = 0;
|
277
|
1887 val.hpos = XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0;
|
|
1888
|
|
1889 while (--height >= 0)
|
|
1890 {
|
|
1891 val = *display_text_line (w, pos, vpos, val.hpos, tab_offset);
|
|
1892 tab_offset += width;
|
10641
|
1893 /* For the first line displayed, display_text_line
|
|
1894 subtracts the prompt width from the tab offset.
|
|
1895 But it does not affect the value of our variable tab_offset.
|
|
1896 So we do the subtraction again,
|
|
1897 for the sake of continuation lines of that first line. */
|
|
1898 if (MINI_WINDOW_P (w) && vpos == XFASTINT (w->top))
|
|
1899 tab_offset -= minibuf_prompt_width;
|
|
1900
|
277
|
1901 if (val.vpos) tab_offset = 0;
|
|
1902 vpos++;
|
|
1903 if (pos != val.bufpos)
|
10965
|
1904 {
|
|
1905 int invis = 0;
|
6065
ab1aef4b0e07
(try_window): Add #ifdef USE_TEXT_PROPERTIES around call to Fget_text_property.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1906 #ifdef USE_TEXT_PROPERTIES
|
10965
|
1907 Lisp_Object invis_prop;
|
|
1908 invis_prop = Fget_char_property (val.bufpos-1, Qinvisible, window);
|
|
1909 invis = TEXT_PROP_MEANS_INVISIBLE (invis_prop);
|
6065
ab1aef4b0e07
(try_window): Add #ifdef USE_TEXT_PROPERTIES around call to Fget_text_property.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1910 #endif
|
10965
|
1911
|
|
1912 last_text_vpos
|
|
1913 /* Next line, unless prev line ended in end of buffer with no cr */
|
|
1914 = vpos - (val.vpos
|
|
1915 && (FETCH_CHAR (val.bufpos - 1) != '\n' || invis));
|
|
1916 }
|
277
|
1917 pos = val.bufpos;
|
|
1918 }
|
|
1919
|
|
1920 /* If last line is continued in middle of character,
|
769
|
1921 include the split character in the text considered on the frame */
|
277
|
1922 if (val.hpos < (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0))
|
|
1923 pos++;
|
|
1924
|
769
|
1925 /* If bottom just moved off end of frame, change mode line percentage. */
|
277
|
1926 if (XFASTINT (w->window_end_pos) == 0
|
|
1927 && Z != pos)
|
|
1928 w->update_mode_line = Qt;
|
|
1929
|
769
|
1930 /* Say where last char on frame will be, once redisplay is finished. */
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1931 XSETFASTINT (w->window_end_pos, Z - pos);
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1932 XSETFASTINT (w->window_end_vpos, last_text_vpos - XFASTINT (w->top));
|
277
|
1933 /* But that is not valid info until redisplay finishes. */
|
|
1934 w->window_end_valid = Qnil;
|
|
1935 }
|
|
1936
|
|
1937 /* Try to redisplay when buffer is modified locally,
|
|
1938 computing insert/delete line to preserve text outside
|
|
1939 the bounds of the changes.
|
|
1940 Return 1 if successful, 0 if if cannot tell what to do,
|
|
1941 or -1 to tell caller to find a new window start,
|
|
1942 or -2 to tell caller to do normal redisplay with same window start. */
|
|
1943
|
|
1944 static int
|
|
1945 try_window_id (window)
|
|
1946 Lisp_Object window;
|
|
1947 {
|
|
1948 int pos;
|
|
1949 register struct window *w = XWINDOW (window);
|
|
1950 register int height = window_internal_height (w);
|
769
|
1951 FRAME_PTR f = XFRAME (w->frame);
|
277
|
1952 int top = XFASTINT (w->top);
|
|
1953 int start = marker_position (w->start);
|
1785
|
1954 int width = window_internal_width (w) - 1;
|
277
|
1955 int hscroll = XINT (w->hscroll);
|
|
1956 int lmargin = hscroll > 0 ? 1 - hscroll : 0;
|
11854
|
1957 int did_motion;
|
277
|
1958 register int vpos;
|
|
1959 register int i, tem;
|
|
1960 int last_text_vpos = 0;
|
|
1961 int stop_vpos;
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1962 int selective = (INTEGERP (current_buffer->selective_display)
|
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1963 ? XINT (current_buffer->selective_display)
|
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1964 : !NILP (current_buffer->selective_display) ? -1 : 0);
|
277
|
1965
|
|
1966 struct position val, bp, ep, xp, pp;
|
|
1967 int scroll_amount = 0;
|
|
1968 int delta;
|
13459
|
1969 int tab_offset, epto, old_tick;
|
277
|
1970
|
|
1971 if (GPT - BEG < beg_unchanged)
|
|
1972 beg_unchanged = GPT - BEG;
|
|
1973 if (Z - GPT < end_unchanged)
|
|
1974 end_unchanged = Z - GPT;
|
|
1975
|
5739
|
1976 if (beg_unchanged + BEG < start)
|
277
|
1977 return 0; /* Give up if changes go above top of window */
|
|
1978
|
|
1979 /* Find position before which nothing is changed. */
|
11854
|
1980 bp = *compute_motion (start, 0, lmargin, 0,
|
11111
|
1981 min (ZV, beg_unchanged + BEG), height, 0,
|
6692
|
1982 width, hscroll, pos_tab_offset (w, start), w);
|
277
|
1983 if (bp.vpos >= height)
|
368
|
1984 {
|
11111
|
1985 if (PT < bp.bufpos)
|
368
|
1986 {
|
13266
|
1987 /* All changes are beyond the window end, and point is on the screen.
|
|
1988 We don't need to change the text at all.
|
368
|
1989 But we need to update window_end_pos to account for
|
|
1990 any change in buffer size. */
|
11854
|
1991 bp = *compute_motion (start, 0, lmargin, 0,
|
13266
|
1992 ZV, height, 0,
|
6692
|
1993 width, hscroll, pos_tab_offset (w, start), w);
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1994 XSETFASTINT (w->window_end_vpos, height);
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
1995 XSETFASTINT (w->window_end_pos, Z - bp.bufpos);
|
11108
|
1996 goto findpoint;
|
368
|
1997 }
|
|
1998 return 0;
|
|
1999 }
|
277
|
2000
|
|
2001 vpos = bp.vpos;
|
|
2002
|
769
|
2003 /* Find beginning of that frame line. Must display from there. */
|
11810
|
2004 bp = *vmotion (bp.bufpos, 0, w);
|
277
|
2005
|
|
2006 pos = bp.bufpos;
|
|
2007 val.hpos = lmargin;
|
|
2008 if (pos < start)
|
|
2009 return -1;
|
|
2010
|
11854
|
2011 did_motion = 0;
|
277
|
2012 /* If about to start displaying at the beginning of a continuation line,
|
769
|
2013 really start with previous frame line, in case it was not
|
277
|
2014 continued when last redisplayed */
|
528
|
2015 if ((bp.contin && bp.bufpos - 1 == beg_unchanged && vpos > 0)
|
|
2016 ||
|
|
2017 /* Likewise if we have to worry about selective display. */
|
5942
|
2018 (selective > 0 && bp.bufpos - 1 == beg_unchanged && vpos > 0))
|
277
|
2019 {
|
11810
|
2020 bp = *vmotion (bp.bufpos, -1, w);
|
277
|
2021 --vpos;
|
|
2022 pos = bp.bufpos;
|
|
2023 }
|
|
2024
|
|
2025 if (bp.contin && bp.hpos != lmargin)
|
|
2026 {
|
|
2027 val.hpos = bp.prevhpos - width + lmargin;
|
11854
|
2028 did_motion = 1;
|
277
|
2029 pos--;
|
|
2030 }
|
|
2031
|
|
2032 bp.vpos = vpos;
|
|
2033
|
|
2034 /* Find first visible newline after which no more is changed. */
|
|
2035 tem = find_next_newline (Z - max (end_unchanged, Z - ZV), 1);
|
5942
|
2036 if (selective > 0)
|
|
2037 while (tem < ZV - 1 && (indented_beyond_p (tem, selective)))
|
277
|
2038 tem = find_next_newline (tem, 1);
|
|
2039
|
|
2040 /* Compute the cursor position after that newline. */
|
11854
|
2041 ep = *compute_motion (pos, vpos, val.hpos, did_motion, tem,
|
13363
|
2042 height, - (1 << (BITS_PER_SHORT - 1)),
|
6692
|
2043 width, hscroll, pos_tab_offset (w, bp.bufpos), w);
|
277
|
2044
|
769
|
2045 /* If changes reach past the text available on the frame,
|
|
2046 just display rest of frame. */
|
277
|
2047 if (ep.bufpos > Z - XFASTINT (w->window_end_pos))
|
|
2048 stop_vpos = height;
|
|
2049 else
|
|
2050 stop_vpos = ep.vpos;
|
|
2051
|
|
2052 /* If no newline before ep, the line ep is on includes some changes
|
|
2053 that must be displayed. Make sure we don't stop before it. */
|
|
2054 /* Also, if changes reach all the way until ep.bufpos,
|
|
2055 it is possible that something was deleted after the
|
|
2056 newline before it, so the following line must be redrawn. */
|
|
2057 if (stop_vpos == ep.vpos
|
|
2058 && (ep.bufpos == BEGV
|
|
2059 || FETCH_CHAR (ep.bufpos - 1) != '\n'
|
|
2060 || ep.bufpos == Z - end_unchanged))
|
|
2061 stop_vpos = ep.vpos + 1;
|
|
2062
|
|
2063 cursor_vpos = -1;
|
|
2064 overlay_arrow_seen = 0;
|
11854
|
2065 zv_strings_seen = 0;
|
277
|
2066
|
|
2067 /* If changes do not reach to bottom of window,
|
|
2068 figure out how much to scroll the rest of the window */
|
|
2069 if (stop_vpos < height)
|
|
2070 {
|
|
2071 /* Now determine how far up or down the rest of the window has moved */
|
|
2072 epto = pos_tab_offset (w, ep.bufpos);
|
11854
|
2073 xp = *compute_motion (ep.bufpos, ep.vpos, ep.hpos, 1,
|
277
|
2074 Z - XFASTINT (w->window_end_pos),
|
6692
|
2075 10000, 0, width, hscroll, epto, w);
|
277
|
2076 scroll_amount = xp.vpos - XFASTINT (w->window_end_vpos);
|
|
2077
|
769
|
2078 /* Is everything on frame below the changes whitespace?
|
277
|
2079 If so, no scrolling is really necessary. */
|
|
2080 for (i = ep.bufpos; i < xp.bufpos; i++)
|
|
2081 {
|
|
2082 tem = FETCH_CHAR (i);
|
|
2083 if (tem != ' ' && tem != '\n' && tem != '\t')
|
|
2084 break;
|
|
2085 }
|
|
2086 if (i == xp.bufpos)
|
|
2087 return -2;
|
|
2088
|
9330
|
2089 XSETFASTINT (w->window_end_vpos,
|
|
2090 XFASTINT (w->window_end_vpos) + scroll_amount);
|
277
|
2091
|
769
|
2092 /* Before doing any scrolling, verify that point will be on frame. */
|
6705
|
2093 if (PT > ep.bufpos && !(PT <= xp.bufpos && xp.bufpos < height))
|
277
|
2094 {
|
6705
|
2095 if (PT <= xp.bufpos)
|
277
|
2096 {
|
11854
|
2097 pp = *compute_motion (ep.bufpos, ep.vpos, ep.hpos, 1,
|
13363
|
2098 PT, height, - (1 << (BITS_PER_SHORT - 1)),
|
6692
|
2099 width, hscroll, epto, w);
|
277
|
2100 }
|
|
2101 else
|
|
2102 {
|
11854
|
2103 pp = *compute_motion (xp.bufpos, xp.vpos, xp.hpos, 1,
|
13363
|
2104 PT, height, - (1 << (BITS_PER_SHORT - 1)),
|
6692
|
2105 width, hscroll,
|
|
2106 pos_tab_offset (w, xp.bufpos), w);
|
277
|
2107 }
|
6705
|
2108 if (pp.bufpos < PT || pp.vpos == height)
|
277
|
2109 return 0;
|
|
2110 cursor_vpos = pp.vpos + top;
|
11810
|
2111 cursor_hpos = XFASTINT (w->left) + minmax (0, pp.hpos, width);
|
277
|
2112 }
|
|
2113
|
|
2114 if (stop_vpos - scroll_amount >= height
|
|
2115 || ep.bufpos == xp.bufpos)
|
|
2116 {
|
|
2117 if (scroll_amount < 0)
|
|
2118 stop_vpos -= scroll_amount;
|
|
2119 scroll_amount = 0;
|
|
2120 /* In this path, we have altered window_end_vpos
|
|
2121 and not left it negative.
|
|
2122 We must make sure that, in case display is preempted
|
769
|
2123 before the frame changes to reflect what we do here,
|
277
|
2124 further updates will not come to try_window_id
|
769
|
2125 and assume the frame and window_end_vpos match. */
|
277
|
2126 blank_end_of_window = 1;
|
|
2127 }
|
|
2128 else if (!scroll_amount)
|
6650
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2129 {
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2130 /* Even if we don't need to scroll, we must adjust the
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2131 charstarts of subsequent lines (that we won't redisplay)
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2132 according to the amount of text inserted or deleted. */
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2133 int oldpos = FRAME_CURRENT_GLYPHS (f)->charstarts[ep.vpos + top][0];
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2134 int adjust = ep.bufpos - oldpos;
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2135 adjust_window_charstarts (w, ep.vpos + top - 1, adjust);
|
a406a09cb770
(redisplay): do_verify_charstarts controls whether to call verify_charstarts.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2136 }
|
277
|
2137 else if (bp.bufpos == Z - end_unchanged)
|
|
2138 {
|
|
2139 /* If reprinting everything is nearly as fast as scrolling,
|
|
2140 don't bother scrolling. Can happen if lines are short. */
|
769
|
2141 if (scroll_cost (f, bp.vpos + top - scroll_amount,
|
277
|
2142 top + height - max (0, scroll_amount),
|
|
2143 scroll_amount)
|
|
2144 > xp.bufpos - bp.bufpos - 20)
|
|
2145 /* Return "try normal display with same window-start."
|
|
2146 Too bad we can't prevent further scroll-thinking. */
|
|
2147 return -2;
|
|
2148 /* If pure deletion, scroll up as many lines as possible.
|
|
2149 In common case of killing a line, this can save the
|
|
2150 following line from being overwritten by scrolling
|
|
2151 and therefore having to be redrawn. */
|
769
|
2152 tem = scroll_frame_lines (f, bp.vpos + top - scroll_amount,
|
6628
|
2153 top + height - max (0, scroll_amount),
|
|
2154 scroll_amount, bp.bufpos);
|
6684
|
2155 if (!tem)
|
|
2156 stop_vpos = height;
|
|
2157 else
|
|
2158 {
|
|
2159 /* scroll_frame_lines did not properly adjust subsequent
|
|
2160 lines' charstarts in the case where the text of the
|
|
2161 screen line at bp.vpos has changed.
|
|
2162 (This can happen in a deletion that ends in mid-line.)
|
14036
|
2163 To adjust properly, we need to make things consistent
|
|
2164 at the position ep.
|
6684
|
2165 So do a second adjust to make that happen.
|
|
2166 Note that stop_vpos >= ep.vpos, so it is sufficient
|
|
2167 to update the charstarts for lines at ep.vpos and below. */
|
|
2168 int oldstart
|
|
2169 = FRAME_CURRENT_GLYPHS (f)->charstarts[ep.vpos + top][0];
|
|
2170 adjust_window_charstarts (w, ep.vpos + top - 1,
|
|
2171 ep.bufpos - oldstart);
|
|
2172 }
|
277
|
2173 }
|
|
2174 else if (scroll_amount)
|
|
2175 {
|
|
2176 /* If reprinting everything is nearly as fast as scrolling,
|
|
2177 don't bother scrolling. Can happen if lines are short. */
|
|
2178 /* Note that if scroll_amount > 0, xp.bufpos - bp.bufpos is an
|
|
2179 overestimate of cost of reprinting, since xp.bufpos
|
|
2180 would end up below the bottom of the window. */
|
769
|
2181 if (scroll_cost (f, ep.vpos + top - scroll_amount,
|
277
|
2182 top + height - max (0, scroll_amount),
|
|
2183 scroll_amount)
|
|
2184 > xp.bufpos - ep.bufpos - 20)
|
|
2185 /* Return "try normal display with same window-start."
|
|
2186 Too bad we can't prevent further scroll-thinking. */
|
|
2187 return -2;
|
769
|
2188 tem = scroll_frame_lines (f, ep.vpos + top - scroll_amount,
|
277
|
2189 top + height - max (0, scroll_amount),
|
6628
|
2190 scroll_amount, ep.bufpos);
|
277
|
2191 if (!tem) stop_vpos = height;
|
|
2192 }
|
|
2193 }
|
|
2194
|
|
2195 /* In any case, do not display past bottom of window */
|
|
2196 if (stop_vpos >= height)
|
|
2197 {
|
|
2198 stop_vpos = height;
|
|
2199 scroll_amount = 0;
|
|
2200 }
|
|
2201
|
|
2202 /* Handle case where pos is before w->start --
|
|
2203 can happen if part of line had been clipped and is not clipped now */
|
|
2204 if (vpos == 0 && pos < marker_position (w->start))
|
|
2205 Fset_marker (w->start, make_number (pos), Qnil);
|
|
2206
|
|
2207 /* Redisplay the lines where the text was changed */
|
|
2208 last_text_vpos = vpos;
|
|
2209 tab_offset = pos_tab_offset (w, pos);
|
|
2210 /* If we are starting display in mid-character, correct tab_offset
|
|
2211 to account for passing the line that that character really starts in. */
|
|
2212 if (val.hpos < lmargin)
|
|
2213 tab_offset += width;
|
13459
|
2214 old_tick = MODIFF;
|
277
|
2215 while (vpos < stop_vpos)
|
|
2216 {
|
|
2217 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset);
|
13459
|
2218 /* If display_text_line ran a hook and changed some text,
|
|
2219 redisplay all the way to bottom of buffer
|
|
2220 So that we show the changes. */
|
|
2221 if (old_tick != MODIFF)
|
|
2222 stop_vpos = height;
|
277
|
2223 tab_offset += width;
|
|
2224 if (val.vpos) tab_offset = 0;
|
|
2225 if (pos != val.bufpos)
|
|
2226 last_text_vpos
|
|
2227 /* Next line, unless prev line ended in end of buffer with no cr */
|
|
2228 = vpos - (val.vpos && FETCH_CHAR (val.bufpos - 1) != '\n');
|
|
2229 pos = val.bufpos;
|
|
2230 }
|
|
2231
|
|
2232 /* There are two cases:
|
|
2233 1) we have displayed down to the bottom of the window
|
|
2234 2) we have scrolled lines below stop_vpos by scroll_amount */
|
|
2235
|
|
2236 if (vpos == height)
|
|
2237 {
|
|
2238 /* If last line is continued in middle of character,
|
769
|
2239 include the split character in the text considered on the frame */
|
277
|
2240 if (val.hpos < lmargin)
|
|
2241 val.bufpos++;
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2242 XSETFASTINT (w->window_end_vpos, last_text_vpos);
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2243 XSETFASTINT (w->window_end_pos, Z - val.bufpos);
|
277
|
2244 }
|
|
2245
|
|
2246 /* If scrolling made blank lines at window bottom,
|
|
2247 redisplay to fill those lines */
|
|
2248 if (scroll_amount < 0)
|
|
2249 {
|
|
2250 /* Don't consider these lines for general-purpose scrolling.
|
|
2251 That will save time in the scrolling computation. */
|
769
|
2252 FRAME_SCROLL_BOTTOM_VPOS (f) = xp.vpos;
|
277
|
2253 vpos = xp.vpos;
|
|
2254 pos = xp.bufpos;
|
|
2255 val.hpos = lmargin;
|
|
2256 if (pos == ZV)
|
|
2257 vpos = height + scroll_amount;
|
|
2258 else if (xp.contin && xp.hpos != lmargin)
|
|
2259 {
|
|
2260 val.hpos = xp.prevhpos - width + lmargin;
|
|
2261 pos--;
|
|
2262 }
|
|
2263
|
|
2264 blank_end_of_window = 1;
|
|
2265 tab_offset = pos_tab_offset (w, pos);
|
|
2266 /* If we are starting display in mid-character, correct tab_offset
|
|
2267 to account for passing the line that that character starts in. */
|
|
2268 if (val.hpos < lmargin)
|
|
2269 tab_offset += width;
|
|
2270
|
|
2271 while (vpos < height)
|
|
2272 {
|
|
2273 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset);
|
|
2274 tab_offset += width;
|
|
2275 if (val.vpos) tab_offset = 0;
|
|
2276 pos = val.bufpos;
|
|
2277 }
|
|
2278
|
|
2279 /* Here is a case where display_text_line sets cursor_vpos wrong.
|
|
2280 Make it be fixed up, below. */
|
|
2281 if (xp.bufpos == ZV
|
6705
|
2282 && xp.bufpos == PT)
|
277
|
2283 cursor_vpos = -1;
|
|
2284 }
|
|
2285
|
769
|
2286 /* If bottom just moved off end of frame, change mode line percentage. */
|
277
|
2287 if (XFASTINT (w->window_end_pos) == 0
|
|
2288 && Z != val.bufpos)
|
|
2289 w->update_mode_line = Qt;
|
|
2290
|
|
2291 /* Attempt to adjust end-of-text positions to new bottom line */
|
|
2292 if (scroll_amount)
|
|
2293 {
|
|
2294 delta = height - xp.vpos;
|
|
2295 if (delta < 0
|
|
2296 || (delta > 0 && xp.bufpos <= ZV)
|
|
2297 || (delta == 0 && xp.hpos))
|
|
2298 {
|
11810
|
2299 val = *vmotion (Z - XFASTINT (w->window_end_pos), delta, w);
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2300 XSETFASTINT (w->window_end_pos, Z - val.bufpos);
|
9330
|
2301 XSETFASTINT (w->window_end_vpos,
|
|
2302 XFASTINT (w->window_end_vpos) + val.vpos);
|
277
|
2303 }
|
|
2304 }
|
|
2305
|
|
2306 w->window_end_valid = Qnil;
|
|
2307
|
|
2308 /* If point was not in a line that was displayed, find it */
|
|
2309 if (cursor_vpos < 0)
|
|
2310 {
|
11108
|
2311 findpoint:
|
11854
|
2312 val = *compute_motion (start, 0, lmargin, 0, PT, 10000, 10000,
|
6692
|
2313 width, hscroll, pos_tab_offset (w, start), w);
|
769
|
2314 /* Admit failure if point is off frame now */
|
277
|
2315 if (val.vpos >= height)
|
|
2316 {
|
|
2317 for (vpos = 0; vpos < height; vpos++)
|
769
|
2318 cancel_line (vpos + top, f);
|
277
|
2319 return 0;
|
|
2320 }
|
|
2321 cursor_vpos = val.vpos + top;
|
11810
|
2322 cursor_hpos = XFASTINT (w->left) + minmax (0, val.hpos, width);
|
277
|
2323 }
|
|
2324
|
11810
|
2325 FRAME_CURSOR_X (f) = cursor_hpos;
|
769
|
2326 FRAME_CURSOR_Y (f) = cursor_vpos;
|
277
|
2327
|
|
2328 if (debug_end_pos)
|
|
2329 {
|
11854
|
2330 val = *compute_motion (start, 0, lmargin, 0, ZV,
|
13363
|
2331 height, - (1 << (BITS_PER_SHORT - 1)),
|
6692
|
2332 width, hscroll, pos_tab_offset (w, start), w);
|
277
|
2333 if (val.vpos != XFASTINT (w->window_end_vpos))
|
|
2334 abort ();
|
|
2335 if (XFASTINT (w->window_end_pos)
|
|
2336 != Z - val.bufpos)
|
|
2337 abort ();
|
|
2338 }
|
|
2339
|
|
2340 return 1;
|
|
2341 }
|
|
2342
|
2729
|
2343 /* Mark a section of BUF as modified, but only for the sake of redisplay.
|
|
2344 This is useful for recording changes to overlays.
|
|
2345
|
|
2346 We increment the buffer's modification timestamp and set the
|
|
2347 redisplay caches (windows_or_buffers_changed, beg_unchanged, etc)
|
|
2348 as if the region of text between START and END had been modified;
|
|
2349 the redisplay code will check this against the windows' timestamps,
|
|
2350 and redraw the appropriate area of the buffer.
|
|
2351
|
|
2352 However, if the buffer is unmodified, we bump the last-save
|
|
2353 timestamp as well, so that incrementing the timestamp doesn't fool
|
|
2354 Emacs into thinking that the buffer's text has been modified.
|
|
2355
|
|
2356 Tweaking the timestamps shouldn't hurt the first-modification
|
|
2357 timestamps recorded in the undo records; those values aren't
|
|
2358 written until just before a real text modification is made, so they
|
|
2359 will never catch the timestamp value just before this function gets
|
|
2360 called. */
|
|
2361
|
|
2362 void
|
|
2363 redisplay_region (buf, start, end)
|
|
2364 struct buffer *buf;
|
|
2365 int start, end;
|
|
2366 {
|
|
2367 if (start == end)
|
|
2368 return;
|
|
2369
|
|
2370 if (start > end)
|
|
2371 {
|
|
2372 int temp = start;
|
|
2373 start = end; end = temp;
|
|
2374 }
|
|
2375
|
7933
|
2376 /* If this is a buffer not in the selected window,
|
|
2377 we must do other windows. */
|
|
2378 if (buf != XBUFFER (XWINDOW (selected_window)->buffer))
|
|
2379 windows_or_buffers_changed = 1;
|
8075
|
2380 /* If it's not current, we can't use beg_unchanged, end_unchanged for it. */
|
|
2381 else if (buf != current_buffer)
|
|
2382 windows_or_buffers_changed = 1;
|
7933
|
2383 /* If multiple windows show this buffer, we must do other windows. */
|
|
2384 else if (buffer_shared > 1)
|
2729
|
2385 windows_or_buffers_changed = 1;
|
|
2386 else
|
|
2387 {
|
|
2388 if (unchanged_modified == MODIFF)
|
|
2389 {
|
|
2390 beg_unchanged = start - BEG;
|
|
2391 end_unchanged = Z - end;
|
|
2392 }
|
|
2393 else
|
|
2394 {
|
|
2395 if (Z - end < end_unchanged)
|
|
2396 end_unchanged = Z - end;
|
|
2397 if (start - BEG < beg_unchanged)
|
|
2398 beg_unchanged = start - BEG;
|
|
2399 }
|
|
2400 }
|
|
2401
|
|
2402 /* Increment the buffer's time stamp, but also increment the save
|
10303
|
2403 and autosave timestamps, so as not to screw up that timekeeping. */
|
|
2404 if (BUF_MODIFF (buf) == BUF_SAVE_MODIFF (buf))
|
|
2405 BUF_SAVE_MODIFF (buf)++;
|
2729
|
2406 if (BUF_MODIFF (buf) == buf->auto_save_modified)
|
|
2407 buf->auto_save_modified++;
|
|
2408
|
|
2409 BUF_MODIFF (buf) ++;
|
|
2410 }
|
|
2411
|
|
2412
|
5800
|
2413 /* Copy LEN glyphs starting address FROM to the rope TO.
|
301
|
2414 But don't actually copy the parts that would come in before S.
|
5800
|
2415 Value is TO, advanced past the copied data.
|
|
2416 F is the frame we are displaying in. */
|
|
2417
|
|
2418 static GLYPH *
|
|
2419 copy_part_of_rope (f, to, s, from, len, face)
|
|
2420 FRAME_PTR f;
|
|
2421 register GLYPH *to; /* Copy to here. */
|
2065
|
2422 register GLYPH *s; /* Starting point. */
|
2766
|
2423 Lisp_Object *from; /* Data to copy. */
|
2065
|
2424 int len;
|
2766
|
2425 int face; /* Face to apply to glyphs which don't specify one. */
|
2065
|
2426 {
|
2754
|
2427 int n = len;
|
5800
|
2428 register Lisp_Object *fp = from;
|
|
2429 /* These cache the results of the last call to compute_glyph_face. */
|
|
2430 int last_code = -1;
|
|
2431 int last_merged = 0;
|
277
|
2432
|
9572
|
2433 #ifdef HAVE_FACES
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2434 if (! FRAME_TERMCAP_P (f))
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2435 while (n--)
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2436 {
|
6740
|
2437 int glyph = (INTEGERP (*fp) ? XFASTINT (*fp) : 0);
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2438 int facecode;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2439
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2440 if (FAST_GLYPH_FACE (glyph) == 0)
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2441 /* If GLYPH has no face code, use FACE. */
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2442 facecode = face;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2443 else if (FAST_GLYPH_FACE (glyph) == last_code)
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2444 /* If it's same as previous glyph, use same result. */
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2445 facecode = last_merged;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2446 else
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2447 {
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2448 /* Merge this glyph's face and remember the result. */
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2449 last_code = FAST_GLYPH_FACE (glyph);
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2450 last_merged = facecode = compute_glyph_face (f, last_code, face);
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2451 }
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2452
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2453 if (to >= s)
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2454 *to = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), facecode);
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2455 ++to;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2456 ++fp;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2457 }
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2458 else
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2459 #endif
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2460 while (n--)
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2461 {
|
6741
|
2462 if (to >= s) *to = (INTEGERP (*fp) ? XFASTINT (*fp) : 0);
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2463 ++to;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2464 ++fp;
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2465 }
|
5800
|
2466 return to;
|
|
2467 }
|
|
2468
|
|
2469 /* Correct a glyph by replacing its specified user-level face code
|
|
2470 with a displayable computed face code. */
|
|
2471
|
|
2472 static GLYPH
|
6896
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2473 fix_glyph (f, glyph, cface)
|
5800
|
2474 FRAME_PTR f;
|
|
2475 GLYPH glyph;
|
6896
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2476 int cface;
|
5800
|
2477 {
|
9572
|
2478 #ifdef HAVE_FACES
|
6896
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2479 if (! FRAME_TERMCAP_P (f))
|
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2480 {
|
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2481 if (FAST_GLYPH_FACE (glyph) != 0)
|
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2482 cface = compute_glyph_face (f, FAST_GLYPH_FACE (glyph), cface);
|
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2483 glyph = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), cface);
|
9e949c4d0e4c
(fix_glyph) [HAVE_X_WINDOWS]: When glyph face is 0, use the computed face as
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2484 }
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2485 #endif
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2486 return glyph;
|
277
|
2487 }
|
|
2488
|
9412
|
2489 /* Display one line of window W, starting at position START in W's buffer.
|
|
2490
|
|
2491 Display starting at horizontal position HPOS, expressed relative to
|
|
2492 W's left edge. In situations where the text at START shouldn't
|
|
2493 start at the left margin (i.e. when the window is hscrolled, or
|
|
2494 we're continuing a line which left off in the midst of a
|
|
2495 multi-column character), HPOS should be negative; we throw away
|
|
2496 characters up 'til hpos = 0. So, HPOS must take hscrolling into
|
|
2497 account.
|
277
|
2498
|
|
2499 TABOFFSET is an offset for ostensible hpos, used in tab stop calculations.
|
|
2500
|
9412
|
2501 Display on position VPOS on the frame. It is origin 0, relative to
|
|
2502 the top of the frame, not W.
|
277
|
2503
|
|
2504 Returns a STRUCT POSITION giving character to start next line with
|
|
2505 and where to display it, including a zero or negative hpos.
|
|
2506 The vpos field is not really a vpos; it is 1 unless the line is continued */
|
|
2507
|
|
2508 struct position val_display_text_line;
|
|
2509
|
|
2510 static struct position *
|
|
2511 display_text_line (w, start, vpos, hpos, taboffset)
|
|
2512 struct window *w;
|
|
2513 int start;
|
|
2514 int vpos;
|
|
2515 int hpos;
|
|
2516 int taboffset;
|
|
2517 {
|
|
2518 register int pos = start;
|
|
2519 register int c;
|
|
2520 register GLYPH *p1;
|
|
2521 register int pause;
|
|
2522 register unsigned char *p;
|
|
2523 GLYPH *endp;
|
6684
|
2524 register GLYPH *leftmargin;
|
11854
|
2525 register GLYPH *p1prev;
|
6612
|
2526 register GLYPH *p1start;
|
11854
|
2527 int prevpos;
|
6612
|
2528 int *charstart;
|
769
|
2529 FRAME_PTR f = XFRAME (w->frame);
|
277
|
2530 int tab_width = XINT (current_buffer->tab_width);
|
485
|
2531 int ctl_arrow = !NILP (current_buffer->ctl_arrow);
|
1785
|
2532 int width = window_internal_width (w) - 1;
|
277
|
2533 struct position val;
|
|
2534 int lastpos;
|
|
2535 int invis;
|
10965
|
2536 int last_invis_skip = 0;
|
|
2537 Lisp_Object last_invis_prop;
|
277
|
2538 int hscroll = XINT (w->hscroll);
|
6684
|
2539 int truncate = (hscroll
|
|
2540 || (truncate_partial_width_windows
|
|
2541 && XFASTINT (w->width) < FRAME_WIDTH (f))
|
|
2542 || !NILP (current_buffer->truncate_lines));
|
2848
|
2543
|
|
2544 /* 1 if we should highlight the region. */
|
|
2545 int highlight_region
|
|
2546 = !NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active);
|
|
2547 int region_beg, region_end;
|
|
2548
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2549 int selective = (INTEGERP (current_buffer->selective_display)
|
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2550 ? XINT (current_buffer->selective_display)
|
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2551 : !NILP (current_buffer->selective_display) ? -1 : 0);
|
769
|
2552 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f);
|
13188
|
2553 register struct Lisp_Char_Table *dp = window_display_table (w);
|
2754
|
2554
|
|
2555 Lisp_Object default_invis_vector[3];
|
10965
|
2556 /* Number of characters of ellipsis to display after an invisible line
|
|
2557 if it calls for an ellipsis.
|
|
2558 Note that this value can be nonzero regardless of whether
|
|
2559 selective display is enabled--you must check that separately. */
|
277
|
2560 int selective_rlen
|
10965
|
2561 = (dp && VECTORP (DISP_INVIS_VECTOR (dp))
|
2754
|
2562 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size
|
10965
|
2563 : !NILP (current_buffer->selective_display_ellipses) ? 3 : 0);
|
2754
|
2564 /* This is the sequence of Lisp objects to display
|
|
2565 when there are invisible lines. */
|
|
2566 Lisp_Object *invis_vector_contents
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2567 = (dp && VECTORP (DISP_INVIS_VECTOR (dp))
|
2754
|
2568 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents
|
|
2569 : default_invis_vector);
|
|
2570
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2571 GLYPH truncator = (dp == 0 || !INTEGERP (DISP_TRUNC_GLYPH (dp))
|
5800
|
2572 ? '$' : XINT (DISP_TRUNC_GLYPH (dp)));
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2573 GLYPH continuer = (dp == 0 || !INTEGERP (DISP_CONTINUE_GLYPH (dp))
|
5800
|
2574 ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp)));
|
277
|
2575
|
2729
|
2576 /* The next buffer location at which the face should change, due
|
|
2577 to overlays or text property changes. */
|
|
2578 int next_face_change;
|
|
2579
|
11854
|
2580 /* The next location where the `invisible' property changes, or an
|
|
2581 overlay starts or ends. */
|
|
2582 int next_boundary;
|
|
2583
|
2729
|
2584 /* The face we're currently using. */
|
2766
|
2585 int current_face = 0;
|
6612
|
2586 int i;
|
2729
|
2587
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2588 XSETFASTINT (default_invis_vector[2], '.');
|
2754
|
2589 default_invis_vector[0] = default_invis_vector[1] = default_invis_vector[2];
|
|
2590
|
277
|
2591 hpos += XFASTINT (w->left);
|
769
|
2592 get_display_line (f, vpos, XFASTINT (w->left));
|
2324
24cd3df6f184
(display_string, display_text_line): Allow tab_width up to 1000.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2593 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
|
277
|
2594
|
2848
|
2595 /* Show where to highlight the region. */
|
2965
|
2596 if (highlight_region && XMARKER (current_buffer->mark)->buffer != 0
|
3265
|
2597 /* Maybe highlight only in selected window. */
|
|
2598 && (highlight_nonselected_windows
|
3266
1173bc4814da
(display_text_line): Really check for just the selected window.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
2599 || w == XWINDOW (selected_window)))
|
2848
|
2600 {
|
|
2601 region_beg = marker_position (current_buffer->mark);
|
|
2602 if (PT < region_beg)
|
|
2603 {
|
|
2604 region_end = region_beg;
|
|
2605 region_beg = PT;
|
|
2606 }
|
|
2607 else
|
|
2608 region_end = PT;
|
|
2609 w->region_showing = Qt;
|
|
2610 }
|
|
2611 else
|
|
2612 region_beg = region_end = -1;
|
|
2613
|
9412
|
2614 if (MINI_WINDOW_P (w)
|
11854
|
2615 && start == BEG
|
277
|
2616 && vpos == XFASTINT (w->top))
|
|
2617 {
|
7951
|
2618 if (! NILP (minibuf_prompt))
|
6721
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2619 {
|
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2620 minibuf_prompt_width
|
7951
|
2621 = (display_string (w, vpos, XSTRING (minibuf_prompt)->data,
|
|
2622 XSTRING (minibuf_prompt)->size, hpos,
|
9756
|
2623 /* Display a space if we truncate. */
|
|
2624 ' ',
|
|
2625 1, -1,
|
|
2626 /* Truncate the prompt a little before the
|
|
2627 margin, so user input can at least start
|
|
2628 on the first line. */
|
|
2629 w->width > 10 ? w->width - 4 : -1)
|
6721
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2630 - hpos);
|
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2631 hpos += minibuf_prompt_width;
|
10641
|
2632 taboffset -= minibuf_prompt_width;
|
6721
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2633 }
|
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2634 else
|
26e4c96d8b63
(display_text_line): minibuffer_prompt_width is a distance, not an absolute
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2635 minibuf_prompt_width = 0;
|
277
|
2636 }
|
|
2637
|
9412
|
2638 /* If we're hscrolled at all, use compute_motion to skip over any
|
|
2639 text off the left edge of the window. compute_motion may know
|
|
2640 tricks to do this faster than we can. */
|
|
2641 if (hpos < 0)
|
|
2642 {
|
|
2643 struct position *left_edge
|
11854
|
2644 = compute_motion (pos, vpos, hpos, 0,
|
|
2645 ZV, vpos, 0,
|
9412
|
2646 width, hscroll, taboffset, w);
|
|
2647
|
|
2648 /* Retrieve the buffer position and column provided by
|
|
2649 compute_motion. We can't assume that the column will be
|
|
2650 zero, because you may have multi-column characters crossing
|
|
2651 the left margin.
|
|
2652
|
|
2653 compute_motion may have moved us past the screen position we
|
|
2654 requested, if we hit a multi-column character, or the end of
|
|
2655 the line. If so, back up. */
|
|
2656 if (left_edge->vpos > vpos
|
|
2657 || left_edge->hpos > 0)
|
|
2658 {
|
|
2659 pos = left_edge->bufpos - 1;
|
|
2660 hpos = left_edge->prevhpos;
|
|
2661 }
|
|
2662 else
|
|
2663 {
|
|
2664 pos = left_edge->bufpos;
|
|
2665 hpos = left_edge->hpos;
|
|
2666 }
|
|
2667 }
|
|
2668
|
|
2669 desired_glyphs->bufp[vpos] = start;
|
277
|
2670 p1 = desired_glyphs->glyphs[vpos] + hpos;
|
6612
|
2671 p1start = p1;
|
|
2672 charstart = desired_glyphs->charstarts[vpos] + hpos;
|
|
2673 /* In case we don't ever write anything into it... */
|
7292
|
2674 desired_glyphs->charstarts[vpos][XFASTINT (w->left)] = -1;
|
6684
|
2675 leftmargin = desired_glyphs->glyphs[vpos] + XFASTINT (w->left);
|
|
2676 endp = leftmargin + width;
|
277
|
2677
|
2766
|
2678 /* Arrange the overlays nicely for our purposes. Usually, we call
|
|
2679 display_text_line on only one line at a time, in which case this
|
|
2680 can't really hurt too much, or we call it on lines which appear
|
|
2681 one after another in the buffer, in which case all calls to
|
|
2682 recenter_overlay_lists but the first will be pretty cheap. */
|
|
2683 recenter_overlay_lists (current_buffer, pos);
|
|
2684
|
277
|
2685 /* Loop generating characters.
|
|
2686 Stop at end of buffer, before newline,
|
2729
|
2687 if reach or pass continuation column,
|
|
2688 or at face change. */
|
277
|
2689 pause = pos;
|
2729
|
2690 next_face_change = pos;
|
11854
|
2691 next_boundary = pos;
|
|
2692 p1prev = p1;
|
|
2693 prevpos = pos;
|
6643
|
2694 while (1)
|
277
|
2695 {
|
2729
|
2696 if (pos >= pause)
|
277
|
2697 {
|
13266
|
2698 int e_t_h;
|
|
2699
|
11854
|
2700 while (pos == next_boundary)
|
|
2701 {
|
|
2702 Lisp_Object position, limit, prop, ww;
|
|
2703
|
|
2704 /* Display the overlay strings here, unless we're at ZV
|
|
2705 and have already displayed the appropriate strings
|
|
2706 on an earlier line. */
|
|
2707 if (pos < ZV || !zv_strings_seen++)
|
|
2708 {
|
|
2709 int ovlen;
|
|
2710 char *ovstr;
|
|
2711 ovlen = overlay_strings (pos, w, &ovstr);
|
|
2712 for (; ovlen; ovlen--, ovstr++)
|
|
2713 {
|
|
2714 if (p1 >= leftmargin && p1 < endp)
|
|
2715 *p1 = MAKE_GLYPH (f, *ovstr, current_face);
|
|
2716 p1++;
|
|
2717 }
|
|
2718 }
|
|
2719
|
|
2720 /* Did we reach point? Record the cursor location. */
|
|
2721 if (pos == PT && cursor_vpos < 0)
|
|
2722 {
|
|
2723 cursor_vpos = vpos;
|
|
2724 cursor_hpos = p1 - leftmargin;
|
|
2725 }
|
|
2726
|
|
2727 if (pos >= ZV)
|
|
2728 break;
|
|
2729
|
|
2730 XSETFASTINT (position, pos);
|
|
2731 limit = Fnext_overlay_change (position);
|
|
2732 #ifdef USE_TEXT_PROPERTIES
|
|
2733 /* This is just an estimate to give reasonable
|
|
2734 performance; nothing should go wrong if it is too small. */
|
|
2735 if (XFASTINT (limit) > pos + 50)
|
|
2736 XSETFASTINT (limit, pos + 50);
|
|
2737 limit = Fnext_single_property_change (position, Qinvisible,
|
|
2738 Fcurrent_buffer (), limit);
|
|
2739 #endif
|
|
2740 next_boundary = XFASTINT (limit);
|
|
2741 /* if the `invisible' property is set, we can skip to
|
|
2742 the next property change. */
|
|
2743 XSETWINDOW (ww, w);
|
|
2744 prop = Fget_char_property (position, Qinvisible, ww);
|
|
2745 if (TEXT_PROP_MEANS_INVISIBLE (prop))
|
|
2746 {
|
|
2747 if (pos < PT && next_boundary >= PT)
|
|
2748 {
|
|
2749 cursor_vpos = vpos;
|
|
2750 cursor_hpos = p1 - leftmargin;
|
|
2751 }
|
|
2752 pos = next_boundary;
|
|
2753 last_invis_skip = pos;
|
|
2754 last_invis_prop = prop;
|
|
2755 }
|
|
2756 }
|
2729
|
2757
|
|
2758 /* Did we reach point? Record the cursor location. */
|
6705
|
2759 if (pos == PT && cursor_vpos < 0)
|
277
|
2760 {
|
|
2761 cursor_vpos = vpos;
|
6684
|
2762 cursor_hpos = p1 - leftmargin;
|
277
|
2763 }
|
|
2764
|
11854
|
2765 /* Did we hit the end of the visible region of the buffer?
|
|
2766 Stop here. */
|
|
2767 if (pos >= ZV)
|
12293
|
2768 {
|
|
2769 /* Update charstarts for the end of this line. */
|
|
2770 /* Do nothing if off the left edge or at the right edge. */
|
|
2771 if (p1 >= leftmargin && p1 + 1 != endp)
|
|
2772 {
|
|
2773 int *p2x = &charstart[(p1 < leftmargin
|
|
2774 ? leftmargin : p1)
|
|
2775 - p1start];
|
|
2776 *p2x++ = pos;
|
|
2777 }
|
|
2778 break;
|
|
2779 }
|
4386
|
2780
|
13266
|
2781 /* Figure out where (if at all) the
|
|
2782 redisplay_end_trigger-hook should run. */
|
13519
|
2783 if (MARKERP (w->redisplay_end_trigger)
|
|
2784 && XMARKER (w->redisplay_end_trigger)->buffer != 0)
|
13459
|
2785 e_t_h = marker_position (w->redisplay_end_trigger);
|
|
2786 else if (INTEGERP (w->redisplay_end_trigger))
|
|
2787 e_t_h = XINT (w->redisplay_end_trigger);
|
13266
|
2788 else
|
|
2789 e_t_h = ZV;
|
|
2790
|
|
2791 /* If we've gone past the place to run a hook,
|
|
2792 run the hook. */
|
|
2793 if (pos >= e_t_h && e_t_h != ZV)
|
|
2794 {
|
13584
|
2795 Lisp_Object args[3];
|
|
2796
|
|
2797 args[0] = Qredisplay_end_trigger_functions;
|
|
2798 XSETWINDOW (args[1], w);
|
|
2799 XSETINT (args[2], e_t_h);
|
14133
|
2800
|
|
2801 /* Since we are *trying* to run these functions,
|
|
2802 don't try to run them again, even if they get an error. */
|
|
2803 w->redisplay_end_trigger = Qnil;
|
13584
|
2804 Frun_hook_with_args (3, args);
|
|
2805
|
13266
|
2806 e_t_h = ZV;
|
13519
|
2807 /* Notice if it changed the face of this character. */
|
|
2808 next_face_change = pos;
|
13266
|
2809 }
|
|
2810
|
13519
|
2811 #ifdef HAVE_FACES
|
|
2812 /* Did we hit a face change? Figure out what face we should
|
|
2813 use now. We also hit this the first time through the
|
|
2814 loop, to see what face we should start with. */
|
|
2815 if (pos >= next_face_change && (FRAME_WINDOW_P (f)))
|
|
2816 current_face = compute_char_face (f, w, pos,
|
|
2817 region_beg, region_end,
|
|
2818 &next_face_change, pos + 50, 0);
|
|
2819 #endif
|
|
2820
|
13266
|
2821 /* Compute the next place we need to stop
|
|
2822 and do something special; set PAUSE. */
|
|
2823
|
11854
|
2824 pause = ZV;
|
|
2825
|
|
2826 if (pos < next_boundary && next_boundary < pause)
|
|
2827 pause = next_boundary;
|
2766
|
2828 if (pos < next_face_change && next_face_change < pause)
|
|
2829 pause = next_face_change;
|
|
2830
|
13266
|
2831 if (e_t_h < pause)
|
|
2832 pause = e_t_h;
|
|
2833
|
2729
|
2834 /* Wouldn't you hate to read the next line to someone over
|
|
2835 the phone? */
|
6705
|
2836 if (pos < PT && PT < pause)
|
|
2837 pause = PT;
|
277
|
2838 if (pos < GPT && GPT < pause)
|
|
2839 pause = GPT;
|
|
2840
|
|
2841 p = &FETCH_CHAR (pos);
|
|
2842 }
|
11854
|
2843
|
|
2844 if (p1 >= endp)
|
|
2845 break;
|
|
2846
|
|
2847 p1prev = p1;
|
|
2848
|
277
|
2849 c = *p++;
|
10822
|
2850 /* Let a display table override all standard display methods. */
|
|
2851 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
|
|
2852 {
|
|
2853 p1 = copy_part_of_rope (f, p1, leftmargin,
|
|
2854 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents,
|
|
2855 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size,
|
|
2856 current_face);
|
|
2857 }
|
|
2858 else if (c >= 040 && c < 0177)
|
277
|
2859 {
|
6684
|
2860 if (p1 >= leftmargin)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2861 *p1 = MAKE_GLYPH (f, c, current_face);
|
277
|
2862 p1++;
|
|
2863 }
|
|
2864 else if (c == '\n')
|
|
2865 {
|
|
2866 invis = 0;
|
10965
|
2867 if (last_invis_skip == pos
|
|
2868 && TEXT_PROP_MEANS_INVISIBLE_WITH_ELLIPSIS (last_invis_prop))
|
|
2869 invis = 1;
|
11854
|
2870 while (pos + 1 < ZV
|
277
|
2871 && selective > 0
|
5942
|
2872 && indented_beyond_p (pos + 1, selective))
|
277
|
2873 {
|
|
2874 invis = 1;
|
|
2875 pos = find_next_newline (pos + 1, 1);
|
|
2876 if (FETCH_CHAR (pos - 1) == '\n')
|
|
2877 pos--;
|
|
2878 }
|
6684
|
2879 if (invis && selective_rlen > 0 && p1 >= leftmargin)
|
277
|
2880 {
|
|
2881 p1 += selective_rlen;
|
6684
|
2882 if (p1 - leftmargin > width)
|
277
|
2883 p1 = endp;
|
5800
|
2884 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
|
2766
|
2885 (p1 - p1prev), current_face);
|
277
|
2886 }
|
9572
|
2887 #ifdef HAVE_FACES
|
2884
|
2888 /* Draw the face of the newline character as extending all the
|
|
2889 way to the end of the frame line. */
|
|
2890 if (current_face)
|
7772
|
2891 {
|
|
2892 if (p1 < leftmargin)
|
|
2893 p1 = leftmargin;
|
|
2894 while (p1 < endp)
|
|
2895 *p1++ = FAST_MAKE_GLYPH (' ', current_face);
|
|
2896 }
|
2884
|
2897 #endif
|
11874
|
2898
|
|
2899 /* Update charstarts for the newline that ended this line. */
|
|
2900 /* Do nothing here for a char that's entirely off the left edge
|
|
2901 or if it starts at the right edge. */
|
|
2902 if (p1 >= leftmargin && p1prev != endp)
|
|
2903 {
|
|
2904 /* Store the newline's position into charstarts
|
|
2905 for the column where the newline starts.
|
|
2906 Store -1 for the rest of the glyphs it occupies. */
|
|
2907 int *p2x = &charstart[(p1prev < leftmargin
|
|
2908 ? leftmargin : p1prev)
|
|
2909 - p1start];
|
|
2910 int *p2 = &charstart[(p1 < endp ? p1 : endp) - p1start];
|
|
2911
|
|
2912 *p2x++ = pos;
|
|
2913 while (p2x < p2)
|
|
2914 *p2x++ = -1;
|
|
2915 }
|
|
2916
|
2754
|
2917 break;
|
277
|
2918 }
|
|
2919 else if (c == '\t')
|
|
2920 {
|
|
2921 do
|
|
2922 {
|
6684
|
2923 if (p1 >= leftmargin && p1 < endp)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2924 *p1 = MAKE_GLYPH (f, ' ', current_face);
|
277
|
2925 p1++;
|
|
2926 }
|
6684
|
2927 while ((p1 - leftmargin + taboffset + hscroll - (hscroll > 0))
|
277
|
2928 % tab_width);
|
|
2929 }
|
368
|
2930 else if (c == Ctl ('M') && selective == -1)
|
277
|
2931 {
|
|
2932 pos = find_next_newline (pos, 1);
|
|
2933 if (FETCH_CHAR (pos - 1) == '\n')
|
|
2934 pos--;
|
|
2935 if (selective_rlen > 0)
|
|
2936 {
|
|
2937 p1 += selective_rlen;
|
6684
|
2938 if (p1 - leftmargin > width)
|
277
|
2939 p1 = endp;
|
5800
|
2940 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
|
2766
|
2941 (p1 - p1prev), current_face);
|
277
|
2942 }
|
9572
|
2943 #ifdef HAVE_FACES
|
2884
|
2944 /* Draw the face of the newline character as extending all the
|
|
2945 way to the end of the frame line. */
|
|
2946 if (current_face)
|
7772
|
2947 {
|
|
2948 if (p1 < leftmargin)
|
|
2949 p1 = leftmargin;
|
|
2950 while (p1 < endp)
|
|
2951 *p1++ = FAST_MAKE_GLYPH (' ', current_face);
|
|
2952 }
|
2884
|
2953 #endif
|
11874
|
2954
|
|
2955 /* Update charstarts for the ^M that ended this line. */
|
|
2956 /* Do nothing here for a char that's entirely off the left edge
|
|
2957 or if it starts at the right edge. */
|
|
2958 if (p1 >= leftmargin && p1prev != endp)
|
|
2959 {
|
|
2960 /* Store the newline's position into charstarts
|
|
2961 for the column where the newline starts.
|
|
2962 Store -1 for the rest of the glyphs it occupies. */
|
|
2963 int *p2x = &charstart[(p1prev < leftmargin
|
|
2964 ? leftmargin : p1prev)
|
|
2965 - p1start];
|
|
2966 int *p2 = &charstart[(p1 < endp ? p1 : endp) - p1start];
|
|
2967
|
|
2968 *p2x++ = pos;
|
|
2969 while (p2x < p2)
|
|
2970 *p2x++ = -1;
|
|
2971 }
|
2754
|
2972 break;
|
277
|
2973 }
|
|
2974 else if (c < 0200 && ctl_arrow)
|
|
2975 {
|
6684
|
2976 if (p1 >= leftmargin)
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2977 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
|
5800
|
2978 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
|
|
2979 current_face);
|
277
|
2980 p1++;
|
6684
|
2981 if (p1 >= leftmargin && p1 < endp)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2982 *p1 = MAKE_GLYPH (f, c ^ 0100, current_face);
|
277
|
2983 p1++;
|
|
2984 }
|
|
2985 else
|
|
2986 {
|
6684
|
2987 if (p1 >= leftmargin)
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2988 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
|
5800
|
2989 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
|
|
2990 current_face);
|
277
|
2991 p1++;
|
6684
|
2992 if (p1 >= leftmargin && p1 < endp)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2993 *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face);
|
2729
|
2994 p1++;
|
6684
|
2995 if (p1 >= leftmargin && p1 < endp)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2996 *p1 = MAKE_GLYPH (f, (7 & (c >> 3)) + '0', current_face);
|
277
|
2997 p1++;
|
6684
|
2998 if (p1 >= leftmargin && p1 < endp)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
2999 *p1 = MAKE_GLYPH (f, (7 & c) + '0', current_face);
|
277
|
3000 p1++;
|
|
3001 }
|
2729
|
3002
|
11854
|
3003 prevpos = pos;
|
277
|
3004 pos++;
|
11874
|
3005
|
|
3006 /* Update charstarts for the character just output. */
|
|
3007
|
|
3008 /* Do nothing here for a char that's entirely off the left edge. */
|
|
3009 if (p1 >= leftmargin)
|
|
3010 {
|
|
3011 /* Store the char's position into charstarts
|
|
3012 for the first glyph occupied by this char.
|
|
3013 Store -1 for the rest of the glyphs it occupies. */
|
|
3014 if (p1 != p1prev)
|
|
3015 {
|
|
3016 int *p2x = &charstart[(p1prev < leftmargin
|
|
3017 ? leftmargin : p1prev)
|
|
3018 - p1start];
|
|
3019 int *p2 = &charstart[(p1 < endp ? p1 : endp) - p1start];
|
|
3020
|
|
3021 if (p2x < p2)
|
|
3022 *p2x++ = prevpos;
|
|
3023 while (p2x < p2)
|
|
3024 *p2x++ = -1;
|
|
3025 }
|
|
3026 }
|
277
|
3027 }
|
|
3028
|
|
3029 val.hpos = - XINT (w->hscroll);
|
|
3030 if (val.hpos)
|
|
3031 val.hpos++;
|
|
3032
|
|
3033 val.vpos = 1;
|
|
3034
|
|
3035 lastpos = pos;
|
|
3036
|
6612
|
3037 /* Store 0 in this charstart line for the positions where
|
|
3038 there is no character. But do leave what was recorded
|
|
3039 for the character that ended the line. */
|
6643
|
3040 /* Add 1 in the endtest to compensate for the fact that ENDP was
|
|
3041 made from WIDTH, which is 1 less than the window's actual
|
|
3042 internal width. */
|
7292
|
3043 i = p1 - p1start + 1;
|
|
3044 if (p1 < leftmargin)
|
|
3045 i += leftmargin - p1;
|
|
3046 for (; i < endp - p1start + 1; i++)
|
6612
|
3047 charstart[i] = 0;
|
|
3048
|
277
|
3049 /* Handle continuation in middle of a character */
|
|
3050 /* by backing up over it */
|
|
3051 if (p1 > endp)
|
|
3052 {
|
3586
|
3053 /* Don't back up if we never actually displayed any text.
|
|
3054 This occurs when the minibuffer prompt takes up the whole line. */
|
|
3055 if (p1prev)
|
|
3056 {
|
|
3057 /* Start the next line with that same character */
|
|
3058 pos--;
|
|
3059 /* but at negative hpos, to skip the columns output on this line. */
|
|
3060 val.hpos += p1prev - endp;
|
|
3061 }
|
|
3062
|
277
|
3063 /* Keep in this line everything up to the continuation column. */
|
|
3064 p1 = endp;
|
|
3065 }
|
|
3066
|
|
3067 /* Finish deciding which character to start the next line on,
|
|
3068 and what hpos to start it at.
|
|
3069 Also set `lastpos' to the last position which counts as "on this line"
|
|
3070 for cursor-positioning. */
|
|
3071
|
|
3072 if (pos < ZV)
|
|
3073 {
|
|
3074 if (FETCH_CHAR (pos) == '\n')
|
6568
|
3075 {
|
|
3076 /* If stopped due to a newline, start next line after it */
|
|
3077 pos++;
|
|
3078 /* Check again for hidden lines, in case the newline occurred exactly
|
|
3079 at the right margin. */
|
|
3080 while (pos < ZV && selective > 0
|
|
3081 && indented_beyond_p (pos, selective))
|
|
3082 pos = find_next_newline (pos, 1);
|
|
3083 }
|
277
|
3084 else
|
|
3085 /* Stopped due to right margin of window */
|
|
3086 {
|
|
3087 if (truncate)
|
|
3088 {
|
5800
|
3089 *p1++ = fix_glyph (f, truncator, 0);
|
277
|
3090 /* Truncating => start next line after next newline,
|
|
3091 and point is on this line if it is before the newline,
|
|
3092 and skip none of first char of next line */
|
6568
|
3093 do
|
|
3094 pos = find_next_newline (pos, 1);
|
|
3095 while (pos < ZV && selective > 0
|
|
3096 && indented_beyond_p (pos, selective));
|
277
|
3097 val.hpos = XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0;
|
|
3098
|
|
3099 lastpos = pos - (FETCH_CHAR (pos - 1) == '\n');
|
|
3100 }
|
|
3101 else
|
|
3102 {
|
5800
|
3103 *p1++ = fix_glyph (f, continuer, 0);
|
277
|
3104 val.vpos = 0;
|
|
3105 lastpos--;
|
|
3106 }
|
|
3107 }
|
|
3108 }
|
|
3109
|
|
3110 /* If point is at eol or in invisible text at eol,
|
769
|
3111 record its frame location now. */
|
277
|
3112
|
6705
|
3113 if (start <= PT && PT <= lastpos && cursor_vpos < 0)
|
277
|
3114 {
|
|
3115 cursor_vpos = vpos;
|
6684
|
3116 cursor_hpos = p1 - leftmargin;
|
277
|
3117 }
|
|
3118
|
|
3119 if (cursor_vpos == vpos)
|
|
3120 {
|
|
3121 if (cursor_hpos < 0) cursor_hpos = 0;
|
|
3122 if (cursor_hpos > width) cursor_hpos = width;
|
|
3123 cursor_hpos += XFASTINT (w->left);
|
769
|
3124 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
|
277
|
3125 {
|
11649
|
3126 if (!(cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f)
|
|
3127 && EQ (FRAME_MINIBUF_WINDOW (f), minibuf_window)))
|
|
3128 {
|
|
3129 FRAME_CURSOR_Y (f) = cursor_vpos;
|
|
3130 FRAME_CURSOR_X (f) = cursor_hpos;
|
|
3131 }
|
277
|
3132
|
|
3133 if (w == XWINDOW (selected_window))
|
|
3134 {
|
|
3135 /* Line is not continued and did not start
|
|
3136 in middle of character */
|
|
3137 if ((hpos - XFASTINT (w->left)
|
|
3138 == (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0))
|
|
3139 && val.vpos)
|
|
3140 {
|
|
3141 this_line_bufpos = start;
|
|
3142 this_line_buffer = current_buffer;
|
|
3143 this_line_vpos = cursor_vpos;
|
|
3144 this_line_start_hpos = hpos;
|
|
3145 this_line_endpos = Z - lastpos;
|
|
3146 }
|
|
3147 else
|
|
3148 this_line_bufpos = 0;
|
|
3149 }
|
|
3150 }
|
|
3151 }
|
|
3152
|
|
3153 /* If hscroll and line not empty, insert truncation-at-left marker */
|
|
3154 if (hscroll && lastpos != start)
|
|
3155 {
|
6684
|
3156 *leftmargin = fix_glyph (f, truncator, 0);
|
|
3157 if (p1 <= leftmargin)
|
|
3158 p1 = leftmargin + 1;
|
277
|
3159 }
|
|
3160
|
769
|
3161 if (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f))
|
277
|
3162 {
|
|
3163 endp++;
|
6684
|
3164 if (p1 < leftmargin) p1 = leftmargin;
|
277
|
3165 while (p1 < endp) *p1++ = SPACEGLYPH;
|
1785
|
3166
|
1992
|
3167 /* Don't draw vertical bars if we're using scroll bars. They're
|
|
3168 covered up by the scroll bars, and it's distracting to see
|
|
3169 them when the scroll bar windows are flickering around to be
|
1785
|
3170 reconfigured. */
|
12921
|
3171 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
|
|
3172 {
|
|
3173 int i;
|
|
3174 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++)
|
|
3175 *p1++ = SPACEGLYPH;
|
|
3176 }
|
|
3177 else
|
|
3178 *p1++ = (dp && INTEGERP (DISP_BORDER_GLYPH (dp))
|
|
3179 ? DISP_BORDER_GLYPH (dp)
|
|
3180 : '|');
|
277
|
3181 }
|
|
3182 desired_glyphs->used[vpos] = max (desired_glyphs->used[vpos],
|
|
3183 p1 - desired_glyphs->glyphs[vpos]);
|
|
3184 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0;
|
|
3185
|
|
3186 /* If the start of this line is the overlay arrow-position,
|
|
3187 then put the arrow string into the display-line. */
|
|
3188
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3189 if (MARKERP (Voverlay_arrow_position)
|
277
|
3190 && current_buffer == XMARKER (Voverlay_arrow_position)->buffer
|
|
3191 && start == marker_position (Voverlay_arrow_position)
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3192 && STRINGP (Voverlay_arrow_string)
|
277
|
3193 && ! overlay_arrow_seen)
|
|
3194 {
|
|
3195 unsigned char *p = XSTRING (Voverlay_arrow_string)->data;
|
|
3196 int i;
|
|
3197 int len = XSTRING (Voverlay_arrow_string)->size;
|
3726
|
3198 int arrow_end;
|
277
|
3199
|
1785
|
3200 if (len > width)
|
|
3201 len = width;
|
9572
|
3202 #ifdef HAVE_FACES
|
8471
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3203 if (!NULL_INTERVAL_P (XSTRING (Voverlay_arrow_string)->intervals))
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3204 {
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3205 /* If the arrow string has text props, obey them when displaying. */
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3206 for (i = 0; i < len; i++)
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3207 {
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3208 int c = p[i];
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3209 Lisp_Object face, ilisp;
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3210 int newface;
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3211
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3212 XSETFASTINT (ilisp, i);
|
8471
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3213 face = Fget_text_property (ilisp, Qface, Voverlay_arrow_string);
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3214 newface = compute_glyph_face_1 (f, face, 0);
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3215 leftmargin[i] = FAST_MAKE_GLYPH (c, newface);
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3216 }
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3217 }
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3218 else
|
9572
|
3219 #endif /* HAVE_FACES */
|
8471
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3220 {
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3221 for (i = 0; i < len; i++)
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3222 leftmargin[i] = p[i];
|
64c299dd51b8
(display_text_line): Use the face properties of the overlay arrow, if any.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3223 }
|
3726
|
3224
|
|
3225 /* Bug in SunOS 4.1.1 compiler requires this intermediate variable. */
|
6684
|
3226 arrow_end = (leftmargin - desired_glyphs->glyphs[vpos]) + len;
|
3726
|
3227 if (desired_glyphs->used[vpos] < arrow_end)
|
|
3228 desired_glyphs->used[vpos] = arrow_end;
|
277
|
3229
|
|
3230 overlay_arrow_seen = 1;
|
|
3231 }
|
|
3232
|
|
3233 val.bufpos = pos;
|
|
3234 val_display_text_line = val;
|
|
3235 return &val_display_text_line;
|
|
3236 }
|
|
3237
|
2150
|
3238 /* Redisplay the menu bar in the frame for window W. */
|
|
3239
|
|
3240 static void
|
|
3241 display_menu_bar (w)
|
|
3242 struct window *w;
|
|
3243 {
|
|
3244 Lisp_Object items, tail;
|
|
3245 register int vpos = 0;
|
|
3246 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
|
|
3247 int maxendcol = FRAME_WIDTH (f);
|
|
3248 int hpos = 0;
|
6134
|
3249 int i;
|
2150
|
3250
|
13511
|
3251 #ifdef HAVE_NTGUI
|
|
3252 return;
|
|
3253 #endif
|
|
3254
|
|
3255 #ifdef USE_X_TOOLKIT
|
13459
|
3256 if (FRAME_X_P (f))
|
2150
|
3257 return;
|
13511
|
3258 #endif /* USE_X_TOOLKIT */
|
2150
|
3259
|
|
3260 get_display_line (f, vpos, 0);
|
|
3261
|
6134
|
3262 items = FRAME_MENU_BAR_ITEMS (f);
|
|
3263 for (i = 0; i < XVECTOR (items)->size; i += 3)
|
2150
|
3264 {
|
6134
|
3265 Lisp_Object pos, string;
|
|
3266 string = XVECTOR (items)->contents[i + 1];
|
|
3267 if (NILP (string))
|
|
3268 break;
|
|
3269
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3270 XSETFASTINT (XVECTOR (items)->contents[i + 2], hpos);
|
2150
|
3271
|
|
3272 if (hpos < maxendcol)
|
|
3273 hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos,
|
|
3274 XSTRING (string)->data,
|
5230
|
3275 XSTRING (string)->size,
|
5800
|
3276 hpos, 0, 0, hpos, maxendcol);
|
11065
|
3277 /* Put a space between items. */
|
2189
|
3278 if (hpos < maxendcol)
|
|
3279 {
|
11065
|
3280 int hpos1 = hpos + 1;
|
5800
|
3281 hpos = display_string (w, vpos, "", 0, hpos, 0, 0,
|
2189
|
3282 min (hpos1, maxendcol), maxendcol);
|
|
3283 }
|
2150
|
3284 }
|
|
3285
|
|
3286 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0;
|
|
3287 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
|
2189
|
3288
|
|
3289 /* Fill out the line with spaces. */
|
|
3290 if (maxendcol > hpos)
|
5800
|
3291 hpos = display_string (w, vpos, "", 0, hpos, 0, 0, maxendcol, maxendcol);
|
4423
|
3292
|
|
3293 /* Clear the rest of the lines allocated to the menu bar. */
|
|
3294 vpos++;
|
|
3295 while (vpos < FRAME_MENU_BAR_LINES (f))
|
|
3296 get_display_line (f, vpos++, 0);
|
2150
|
3297 }
|
|
3298
|
277
|
3299 /* Display the mode line for window w */
|
|
3300
|
|
3301 static void
|
|
3302 display_mode_line (w)
|
|
3303 struct window *w;
|
|
3304 {
|
|
3305 register int vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1;
|
|
3306 register int left = XFASTINT (w->left);
|
|
3307 register int right = XFASTINT (w->width) + left;
|
769
|
3308 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
|
277
|
3309
|
2303
|
3310 line_number_displayed = 0;
|
10441
f1fc7b6e5fa4
(redisplay, redisplay_window, display_mode_line, decode_mode_spec): Use window
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3311 w->column_number_displayed = Qnil;
|
2303
|
3312
|
769
|
3313 get_display_line (f, vpos, left);
|
11354
|
3314
|
|
3315 /* Temporarily make frame F's kboard the current kboard
|
|
3316 so that kboard-local variables in the mode_line_format
|
|
3317 will get the right values. */
|
|
3318 push_frame_kboard (f);
|
|
3319
|
|
3320 display_mode_element (w, vpos, left, 0, right, right,
|
|
3321 current_buffer->mode_line_format);
|
|
3322
|
|
3323 pop_frame_kboard ();
|
|
3324
|
769
|
3325 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0;
|
277
|
3326
|
|
3327 /* Make the mode line inverse video if the entire line
|
|
3328 is made of mode lines.
|
|
3329 I.e. if this window is full width,
|
|
3330 or if it is the child of a full width window
|
|
3331 (which implies that that window is split side-by-side
|
|
3332 and the rest of this line is mode lines of the sibling windows). */
|
769
|
3333 if (XFASTINT (w->width) == FRAME_WIDTH (f)
|
|
3334 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
|
|
3335 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
|
9572
|
3336 #ifdef HAVE_FACES
|
11354
|
3337 else if (! FRAME_TERMCAP_P (f) && mode_line_inverse_video)
|
6278
|
3338 {
|
|
3339 /* For a partial width window, explicitly set face of each glyph. */
|
|
3340 int i;
|
|
3341 GLYPH *ptr = FRAME_DESIRED_GLYPHS (f)->glyphs[vpos];
|
|
3342 for (i = left; i < right; ++i)
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3343 ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1);
|
6278
|
3344 }
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3345 #endif
|
277
|
3346 }
|
|
3347
|
|
3348 /* Contribute ELT to the mode line for window W.
|
|
3349 How it translates into text depends on its data type.
|
|
3350
|
|
3351 VPOS is the position of the mode line being displayed.
|
|
3352
|
769
|
3353 HPOS is the position (absolute on frame) where this element's text
|
277
|
3354 should start. The output is truncated automatically at the right
|
|
3355 edge of window W.
|
|
3356
|
|
3357 DEPTH is the depth in recursion. It is used to prevent
|
|
3358 infinite recursion here.
|
|
3359
|
|
3360 MINENDCOL is the hpos before which the element may not end.
|
|
3361 The element is padded at the right with spaces if nec
|
|
3362 to reach this column.
|
|
3363
|
|
3364 MAXENDCOL is the hpos past which this element may not extend.
|
|
3365 If MINENDCOL is > MAXENDCOL, MINENDCOL takes priority.
|
|
3366 (This is necessary to make nested padding and truncation work.)
|
|
3367
|
|
3368 Returns the hpos of the end of the text generated by ELT.
|
|
3369 The next element will receive that value as its HPOS arg,
|
|
3370 so as to concatenate the elements. */
|
|
3371
|
|
3372 static int
|
|
3373 display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt)
|
|
3374 struct window *w;
|
|
3375 register int vpos, hpos;
|
|
3376 int depth;
|
|
3377 int minendcol;
|
|
3378 register int maxendcol;
|
|
3379 register Lisp_Object elt;
|
|
3380 {
|
|
3381 tail_recurse:
|
|
3382 if (depth > 10)
|
|
3383 goto invalid;
|
|
3384
|
|
3385 depth++;
|
|
3386
|
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3387 switch (SWITCH_ENUM_CAST (XTYPE (elt)))
|
277
|
3388 {
|
|
3389 case Lisp_String:
|
|
3390 {
|
|
3391 /* A string: output it and check for %-constructs within it. */
|
|
3392 register unsigned char c;
|
|
3393 register unsigned char *this = XSTRING (elt)->data;
|
|
3394
|
|
3395 while (hpos < maxendcol && *this)
|
|
3396 {
|
|
3397 unsigned char *last = this;
|
|
3398 while ((c = *this++) != '\0' && c != '%')
|
|
3399 ;
|
|
3400 if (this - 1 != last)
|
|
3401 {
|
|
3402 register int lim = --this - last + hpos;
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3403 if (frame_title_ptr)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3404 hpos = store_frame_title (last, hpos, min (lim, maxendcol));
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3405 else
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3406 hpos = display_string (w, vpos, last, -1, hpos, 0, 1,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3407 hpos, min (lim, maxendcol));
|
277
|
3408 }
|
|
3409 else /* c == '%' */
|
|
3410 {
|
12598
|
3411 register int minendcol;
|
277
|
3412 register int spec_width = 0;
|
|
3413
|
|
3414 /* We can't allow -ve args due to the "%-" construct */
|
|
3415 /* Argument specifies minwidth but not maxwidth
|
|
3416 (maxwidth can be specified by
|
|
3417 (<negative-number> . <stuff>) mode-line elements) */
|
|
3418
|
|
3419 while ((c = *this++) >= '0' && c <= '9')
|
|
3420 {
|
|
3421 spec_width = spec_width * 10 + (c - '0');
|
|
3422 }
|
|
3423
|
12598
|
3424 minendcol = hpos + spec_width;
|
|
3425 if (minendcol > maxendcol)
|
|
3426 {
|
|
3427 spec_width = maxendcol - hpos;
|
|
3428 minendcol = maxendcol;
|
|
3429 }
|
277
|
3430
|
|
3431 if (c == 'M')
|
|
3432 hpos = display_mode_element (w, vpos, hpos, depth,
|
|
3433 spec_width, maxendcol,
|
|
3434 Vglobal_mode_string);
|
|
3435 else if (c != 0)
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3436 {
|
12598
|
3437 char *spec = decode_mode_spec (w, c, spec_width,
|
|
3438 maxendcol - hpos);
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3439 if (frame_title_ptr)
|
12598
|
3440 hpos = store_frame_title (spec, minendcol, maxendcol);
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3441 else
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3442 hpos = display_string (w, vpos, spec, -1,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3443 hpos, 0, 1,
|
12598
|
3444 minendcol, maxendcol);
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3445 }
|
277
|
3446 }
|
|
3447 }
|
|
3448 }
|
|
3449 break;
|
|
3450
|
|
3451 case Lisp_Symbol:
|
|
3452 /* A symbol: process the value of the symbol recursively
|
|
3453 as if it appeared here directly. Avoid error if symbol void.
|
|
3454 Special case: if value of symbol is a string, output the string
|
|
3455 literally. */
|
|
3456 {
|
|
3457 register Lisp_Object tem;
|
|
3458 tem = Fboundp (elt);
|
485
|
3459 if (!NILP (tem))
|
277
|
3460 {
|
|
3461 tem = Fsymbol_value (elt);
|
|
3462 /* If value is a string, output that string literally:
|
|
3463 don't check for % within it. */
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3464 if (STRINGP (tem))
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3465 {
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3466 if (frame_title_ptr)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3467 hpos = store_frame_title (XSTRING (tem)->data,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3468 minendcol, maxendcol);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3469 else
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3470 hpos = display_string (w, vpos, XSTRING (tem)->data,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3471 XSTRING (tem)->size,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3472 hpos, 0, 1, minendcol, maxendcol);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3473 }
|
277
|
3474 /* Give up right away for nil or t. */
|
|
3475 else if (!EQ (tem, elt))
|
|
3476 { elt = tem; goto tail_recurse; }
|
|
3477 }
|
|
3478 }
|
|
3479 break;
|
|
3480
|
|
3481 case Lisp_Cons:
|
|
3482 {
|
|
3483 register Lisp_Object car, tem;
|
|
3484
|
|
3485 /* A cons cell: three distinct cases.
|
|
3486 If first element is a string or a cons, process all the elements
|
|
3487 and effectively concatenate them.
|
|
3488 If first element is a negative number, truncate displaying cdr to
|
|
3489 at most that many characters. If positive, pad (with spaces)
|
|
3490 to at least that many characters.
|
|
3491 If first element is a symbol, process the cadr or caddr recursively
|
|
3492 according to whether the symbol's value is non-nil or nil. */
|
|
3493 car = XCONS (elt)->car;
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3494 if (SYMBOLP (car))
|
277
|
3495 {
|
|
3496 tem = Fboundp (car);
|
|
3497 elt = XCONS (elt)->cdr;
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3498 if (!CONSP (elt))
|
277
|
3499 goto invalid;
|
|
3500 /* elt is now the cdr, and we know it is a cons cell.
|
|
3501 Use its car if CAR has a non-nil value. */
|
485
|
3502 if (!NILP (tem))
|
277
|
3503 {
|
|
3504 tem = Fsymbol_value (car);
|
485
|
3505 if (!NILP (tem))
|
277
|
3506 { elt = XCONS (elt)->car; goto tail_recurse; }
|
|
3507 }
|
|
3508 /* Symbol's value is nil (or symbol is unbound)
|
|
3509 Get the cddr of the original list
|
|
3510 and if possible find the caddr and use that. */
|
|
3511 elt = XCONS (elt)->cdr;
|
485
|
3512 if (NILP (elt))
|
277
|
3513 break;
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3514 else if (!CONSP (elt))
|
277
|
3515 goto invalid;
|
|
3516 elt = XCONS (elt)->car;
|
|
3517 goto tail_recurse;
|
|
3518 }
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3519 else if (INTEGERP (car))
|
277
|
3520 {
|
|
3521 register int lim = XINT (car);
|
|
3522 elt = XCONS (elt)->cdr;
|
|
3523 if (lim < 0)
|
|
3524 /* Negative int means reduce maximum width.
|
|
3525 DO NOT change MINENDCOL here!
|
|
3526 (20 -10 . foo) should truncate foo to 10 col
|
|
3527 and then pad to 20. */
|
|
3528 maxendcol = min (maxendcol, hpos - lim);
|
|
3529 else if (lim > 0)
|
|
3530 {
|
|
3531 /* Padding specified. Don't let it be more than
|
|
3532 current maximum. */
|
|
3533 lim += hpos;
|
|
3534 if (lim > maxendcol)
|
|
3535 lim = maxendcol;
|
|
3536 /* If that's more padding than already wanted, queue it.
|
|
3537 But don't reduce padding already specified even if
|
|
3538 that is beyond the current truncation point. */
|
|
3539 if (lim > minendcol)
|
|
3540 minendcol = lim;
|
|
3541 }
|
|
3542 goto tail_recurse;
|
|
3543 }
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3544 else if (STRINGP (car) || CONSP (car))
|
277
|
3545 {
|
|
3546 register int limit = 50;
|
|
3547 /* LIMIT is to protect against circular lists. */
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3548 while (CONSP (elt) && --limit > 0
|
277
|
3549 && hpos < maxendcol)
|
|
3550 {
|
|
3551 hpos = display_mode_element (w, vpos, hpos, depth,
|
|
3552 hpos, maxendcol,
|
|
3553 XCONS (elt)->car);
|
|
3554 elt = XCONS (elt)->cdr;
|
|
3555 }
|
|
3556 }
|
|
3557 }
|
|
3558 break;
|
|
3559
|
|
3560 default:
|
|
3561 invalid:
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3562 if (frame_title_ptr)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3563 hpos = store_frame_title ("*invalid*", minendcol, maxendcol);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3564 else
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3565 hpos = display_string (w, vpos, "*invalid*", -1, hpos, 0, 1,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3566 minendcol, maxendcol);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3567 return hpos;
|
277
|
3568 }
|
|
3569
|
|
3570 if (minendcol > hpos)
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3571 if (frame_title_ptr)
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3572 hpos = store_frame_title ("", minendcol, maxendcol);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3573 else
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3574 hpos = display_string (w, vpos, "", 0, hpos, 0, 1, minendcol, maxendcol);
|
277
|
3575 return hpos;
|
|
3576 }
|
|
3577
|
12598
|
3578 /* Write a null-terminated, right justified decimal representation of
|
|
3579 the positive integer D to BUF using a minimal field width WIDTH. */
|
|
3580
|
|
3581 static void
|
|
3582 pint2str (buf, width, d)
|
|
3583 register char *buf;
|
|
3584 register int width;
|
|
3585 register int d;
|
|
3586 {
|
|
3587 register char *p = buf;
|
|
3588
|
|
3589 if (d <= 0)
|
|
3590 *p++ = '0';
|
|
3591 else
|
|
3592 while (d > 0)
|
|
3593 {
|
|
3594 *p++ = d % 10 + '0';
|
|
3595 d /= 10;
|
|
3596 }
|
|
3597 for (width -= (int) (p - buf); width > 0; --width) *p++ = ' ';
|
|
3598 *p-- = '\0';
|
|
3599 while (p > buf)
|
|
3600 {
|
|
3601 d = *buf;
|
|
3602 *buf++ = *p;
|
|
3603 *p-- = d;
|
|
3604 }
|
|
3605 }
|
|
3606
|
277
|
3607 /* Return a string for the output of a mode line %-spec for window W,
|
12598
|
3608 generated by character C. SPEC_WIDTH is the field width when
|
|
3609 padding to the left (%c, %l). The value returned from this
|
|
3610 function will later be truncated to width MAXWIDTH. */
|
277
|
3611
|
1017
|
3612 static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
|
|
3613
|
277
|
3614 static char *
|
12598
|
3615 decode_mode_spec (w, c, spec_width, maxwidth)
|
277
|
3616 struct window *w;
|
|
3617 register char c;
|
12598
|
3618 register int spec_width;
|
277
|
3619 register int maxwidth;
|
|
3620 {
|
6518
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3621 Lisp_Object obj;
|
769
|
3622 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
|
|
3623 char *decode_mode_spec_buf = (char *) FRAME_TEMP_GLYPHS (f)->total_contents;
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3624 struct buffer *b = XBUFFER (w->buffer);
|
277
|
3625
|
6518
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3626 obj = Qnil;
|
769
|
3627 if (maxwidth > FRAME_WIDTH (f))
|
|
3628 maxwidth = FRAME_WIDTH (f);
|
277
|
3629
|
|
3630 switch (c)
|
|
3631 {
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3632 case '*':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3633 if (!NILP (b->read_only))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3634 return "%";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3635 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3636 return "*";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3637 return "-";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3638
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3639 case '+':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3640 /* This differs from %* only for a modified read-only buffer. */
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3641 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3642 return "*";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3643 if (!NILP (b->read_only))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3644 return "%";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3645 return "-";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3646
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3647 case '&':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3648 /* This differs from %* in ignoring read-only-ness. */
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3649 if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3650 return "*";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3651 return "-";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3652
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3653 case '%':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3654 return "%";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3655
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3656 case '[':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3657 {
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3658 int i;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3659 char *p;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3660
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3661 if (command_loop_level > 5)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3662 return "[[[... ";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3663 p = decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3664 for (i = 0; i < command_loop_level; i++)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3665 *p++ = '[';
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3666 *p = 0;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3667 return decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3668 }
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3669
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3670 case ']':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3671 {
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3672 int i;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3673 char *p;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3674
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3675 if (command_loop_level > 5)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3676 return " ...]]]";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3677 p = decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3678 for (i = 0; i < command_loop_level; i++)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3679 *p++ = ']';
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3680 *p = 0;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3681 return decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3682 }
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3683
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3684 case '-':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3685 {
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3686 register char *p;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3687 register int i;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3688
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3689 if (maxwidth < sizeof (lots_of_dashes))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3690 return lots_of_dashes;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3691 else
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3692 {
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3693 for (p = decode_mode_spec_buf, i = maxwidth; i > 0; i--)
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3694 *p++ = '-';
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3695 *p = '\0';
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3696 }
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3697 return decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3698 }
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3699
|
277
|
3700 case 'b':
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3701 obj = b->name;
|
277
|
3702 #if 0
|
|
3703 if (maxwidth >= 3 && XSTRING (obj)->size > maxwidth)
|
|
3704 {
|
|
3705 bcopy (XSTRING (obj)->data, decode_mode_spec_buf, maxwidth - 1);
|
|
3706 decode_mode_spec_buf[maxwidth - 1] = '\\';
|
|
3707 decode_mode_spec_buf[maxwidth] = '\0';
|
|
3708 return decode_mode_spec_buf;
|
|
3709 }
|
|
3710 #endif
|
|
3711 break;
|
|
3712
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3713 case 'c':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3714 {
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3715 int col = current_column ();
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3716 XSETFASTINT (w->column_number_displayed, col);
|
12598
|
3717 pint2str (decode_mode_spec_buf, spec_width, col);
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3718 return decode_mode_spec_buf;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3719 }
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3720
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3721 case 'F':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3722 /* %F displays the frame name. */
|
12348
|
3723 #ifdef MULTI_FRAME
|
15038
|
3724 if (!NILP (f->title))
|
|
3725 return (char *) XSTRING (f->title)->data;
|
|
3726 if (f->explicit_name || FRAME_TERMCAP_P (f))
|
|
3727 return (char *) XSTRING (f->name)->data;
|
15037
|
3728 #endif
|
12348
|
3729 return "Emacs";
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3730
|
277
|
3731 case 'f':
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3732 obj = b->filename;
|
277
|
3733 #if 0
|
485
|
3734 if (NILP (obj))
|
277
|
3735 return "[none]";
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3736 else if (STRINGP (obj) && XSTRING (obj)->size > maxwidth)
|
277
|
3737 {
|
|
3738 bcopy ("...", decode_mode_spec_buf, 3);
|
|
3739 bcopy (XSTRING (obj)->data + XSTRING (obj)->size - maxwidth + 3,
|
|
3740 decode_mode_spec_buf + 3, maxwidth - 3);
|
|
3741 return decode_mode_spec_buf;
|
|
3742 }
|
|
3743 #endif
|
|
3744 break;
|
|
3745
|
2303
|
3746 case 'l':
|
|
3747 {
|
|
3748 int startpos = marker_position (w->start);
|
|
3749 int line, linepos, topline;
|
|
3750 int nlines, junk;
|
|
3751 Lisp_Object tem;
|
|
3752 int height = XFASTINT (w->height);
|
|
3753
|
|
3754 /* If we decided that this buffer isn't suitable for line numbers,
|
|
3755 don't forget that too fast. */
|
|
3756 if (EQ (w->base_line_pos, w->buffer))
|
12598
|
3757 goto no_value;
|
2303
|
3758
|
|
3759 /* If the buffer is very big, don't waste time. */
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3760 if (BUF_ZV (b) - BUF_BEGV (b) > line_number_display_limit)
|
2303
|
3761 {
|
|
3762 w->base_line_pos = Qnil;
|
|
3763 w->base_line_number = Qnil;
|
12598
|
3764 goto no_value;
|
2303
|
3765 }
|
|
3766
|
|
3767 if (!NILP (w->base_line_number)
|
|
3768 && !NILP (w->base_line_pos)
|
|
3769 && XFASTINT (w->base_line_pos) <= marker_position (w->start))
|
|
3770 {
|
|
3771 line = XFASTINT (w->base_line_number);
|
|
3772 linepos = XFASTINT (w->base_line_pos);
|
|
3773 }
|
|
3774 else
|
|
3775 {
|
|
3776 line = 1;
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3777 linepos = BUF_BEGV (b);
|
2303
|
3778 }
|
|
3779
|
|
3780 /* Count lines from base line to window start position. */
|
|
3781 nlines = display_count_lines (linepos, startpos, startpos, &junk);
|
|
3782
|
|
3783 topline = nlines + line;
|
|
3784
|
|
3785 /* Determine a new base line, if the old one is too close
|
|
3786 or too far away, or if we did not have one.
|
|
3787 "Too close" means it's plausible a scroll-down would
|
|
3788 go back past it. */
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3789 if (startpos == BUF_BEGV (b))
|
2303
|
3790 {
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3791 XSETFASTINT (w->base_line_number, topline);
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3792 XSETFASTINT (w->base_line_pos, BUF_BEGV (b));
|
2303
|
3793 }
|
|
3794 else if (nlines < height + 25 || nlines > height * 3 + 50
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3795 || linepos == BUF_BEGV (b))
|
2303
|
3796 {
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3797 int limit = BUF_BEGV (b);
|
2303
|
3798 int position;
|
|
3799 int distance = (height * 2 + 30) * 200;
|
|
3800
|
|
3801 if (startpos - distance > limit)
|
|
3802 limit = startpos - distance;
|
|
3803
|
|
3804 nlines = display_count_lines (startpos, limit,
|
|
3805 -(height * 2 + 30),
|
|
3806 &position);
|
|
3807 /* If we couldn't find the lines we wanted within
|
|
3808 200 chars per line,
|
|
3809 give up on line numbers for this window. */
|
|
3810 if (position == startpos - distance)
|
|
3811 {
|
|
3812 w->base_line_pos = w->buffer;
|
|
3813 w->base_line_number = Qnil;
|
12598
|
3814 goto no_value;
|
2303
|
3815 }
|
|
3816
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3817 XSETFASTINT (w->base_line_number, topline - nlines);
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3818 XSETFASTINT (w->base_line_pos, position);
|
2303
|
3819 }
|
|
3820
|
|
3821 /* Now count lines from the start pos to point. */
|
|
3822 nlines = display_count_lines (startpos, PT, PT, &junk);
|
|
3823
|
|
3824 /* Record that we did display the line number. */
|
|
3825 line_number_displayed = 1;
|
|
3826
|
|
3827 /* Make the string to show. */
|
12598
|
3828 pint2str (decode_mode_spec_buf, spec_width, topline + nlines);
|
2303
|
3829 return decode_mode_spec_buf;
|
12598
|
3830 no_value:
|
|
3831 {
|
|
3832 char* p = decode_mode_spec_buf;
|
|
3833 for (spec_width -= 2; spec_width > 0; --spec_width) *p++ = ' ';
|
|
3834 strcpy (p, "??");
|
|
3835 return decode_mode_spec_buf;
|
|
3836 }
|
2303
|
3837 }
|
|
3838 break;
|
|
3839
|
277
|
3840 case 'm':
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3841 obj = b->mode_name;
|
277
|
3842 break;
|
|
3843
|
|
3844 case 'n':
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3845 if (BUF_BEGV (b) > BUF_BEG (b) || BUF_ZV (b) < BUF_Z (b))
|
277
|
3846 return " Narrow";
|
|
3847 break;
|
|
3848
|
|
3849 case 'p':
|
|
3850 {
|
|
3851 int pos = marker_position (w->start);
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3852 int total = BUF_ZV (b) - BUF_BEGV (b);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3853
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3854 if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b))
|
277
|
3855 {
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3856 if (pos <= BUF_BEGV (b))
|
277
|
3857 return "All";
|
|
3858 else
|
|
3859 return "Bottom";
|
|
3860 }
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3861 else if (pos <= BUF_BEGV (b))
|
277
|
3862 return "Top";
|
|
3863 else
|
|
3864 {
|
13655
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3865 if (total > 1000000)
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3866 /* Do it differently for a large value, to avoid overflow. */
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3867 total = ((pos - BUF_BEGV (b)) + (total / 100) - 1) / (total / 100);
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3868 else
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3869 total = ((pos - BUF_BEGV (b)) * 100 + total - 1) / total;
|
277
|
3870 /* We can't normally display a 3-digit number,
|
|
3871 so get us a 2-digit number that is close. */
|
|
3872 if (total == 100)
|
|
3873 total = 99;
|
|
3874 sprintf (decode_mode_spec_buf, "%2d%%", total);
|
|
3875 return decode_mode_spec_buf;
|
|
3876 }
|
|
3877 }
|
|
3878
|
5903
|
3879 /* Display percentage of size above the bottom of the screen. */
|
|
3880 case 'P':
|
|
3881 {
|
|
3882 int toppos = marker_position (w->start);
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3883 int botpos = BUF_Z (b) - XFASTINT (w->window_end_pos);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3884 int total = BUF_ZV (b) - BUF_BEGV (b);
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3885
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3886 if (botpos >= BUF_ZV (b))
|
5903
|
3887 {
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3888 if (toppos <= BUF_BEGV (b))
|
5903
|
3889 return "All";
|
|
3890 else
|
|
3891 return "Bottom";
|
|
3892 }
|
|
3893 else
|
|
3894 {
|
13655
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3895 if (total > 1000000)
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3896 /* Do it differently for a large value, to avoid overflow. */
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3897 total = ((botpos - BUF_BEGV (b)) + (total / 100) - 1) / (total / 100);
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3898 else
|
5dd2d988f3c3
(decode_mode_spec): For p and P, avoid overflow with large buffer sizes.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3899 total = ((botpos - BUF_BEGV (b)) * 100 + total - 1) / total;
|
5903
|
3900 /* We can't normally display a 3-digit number,
|
|
3901 so get us a 2-digit number that is close. */
|
|
3902 if (total == 100)
|
|
3903 total = 99;
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3904 if (toppos <= BUF_BEGV (b))
|
5903
|
3905 sprintf (decode_mode_spec_buf, "Top%2d%%", total);
|
|
3906 else
|
|
3907 sprintf (decode_mode_spec_buf, "%2d%%", total);
|
|
3908 return decode_mode_spec_buf;
|
|
3909 }
|
|
3910 }
|
|
3911
|
11291
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3912 case 's':
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3913 /* status of process */
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3914 obj = Fget_buffer_process (w->buffer);
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3915 if (NILP (obj))
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3916 return "no process";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3917 #ifdef subprocesses
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3918 obj = Fsymbol_name (Fprocess_status (obj));
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3919 #endif
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3920 break;
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3921
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3922 case 't': /* indicate TEXT or BINARY */
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3923 #ifdef MODE_LINE_BINARY_TEXT
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3924 return MODE_LINE_BINARY_TEXT (b);
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3925 #else
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3926 return "T";
|
856fe1d1f30d
(redisplay): Don't call update_frame for non-selected termcap frame.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
3927 #endif
|
277
|
3928 }
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3929
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
3930 if (STRINGP (obj))
|
277
|
3931 return (char *) XSTRING (obj)->data;
|
|
3932 else
|
|
3933 return "";
|
|
3934 }
|
8622
|
3935
|
|
3936 /* Search for COUNT instances of a line boundary, which means either a
|
|
3937 newline or (if selective display enabled) a carriage return.
|
|
3938 Start at START. If COUNT is negative, search backwards.
|
|
3939
|
|
3940 If we find COUNT instances, set *SHORTAGE to zero, and return the
|
|
3941 position after the COUNTth match. Note that for reverse motion
|
|
3942 this is not the same as the usual convention for Emacs motion commands.
|
|
3943
|
|
3944 If we don't find COUNT instances before reaching the end of the
|
|
3945 buffer (or the beginning, if scanning backwards), set *SHORTAGE to
|
|
3946 the number of line boundaries left unfound, and return the end of the
|
|
3947 buffer we bumped up against. */
|
|
3948
|
|
3949 static int
|
|
3950 display_scan_buffer (start, count, shortage)
|
|
3951 int *shortage, start;
|
|
3952 register int count;
|
|
3953 {
|
|
3954 int limit = ((count > 0) ? ZV - 1 : BEGV);
|
|
3955 int direction = ((count > 0) ? 1 : -1);
|
|
3956
|
|
3957 register unsigned char *cursor;
|
|
3958 unsigned char *base;
|
|
3959
|
|
3960 register int ceiling;
|
|
3961 register unsigned char *ceiling_addr;
|
|
3962
|
|
3963 /* If we are not in selective display mode,
|
|
3964 check only for newlines. */
|
|
3965 if (! (!NILP (current_buffer->selective_display)
|
|
3966 && !INTEGERP (current_buffer->selective_display)))
|
9451
|
3967 return scan_buffer ('\n', start, 0, count, shortage, 0);
|
8622
|
3968
|
|
3969 /* The code that follows is like scan_buffer
|
|
3970 but checks for either newline or carriage return. */
|
|
3971
|
|
3972 if (shortage != 0)
|
|
3973 *shortage = 0;
|
|
3974
|
|
3975 if (count > 0)
|
|
3976 while (start != limit + 1)
|
|
3977 {
|
|
3978 ceiling = BUFFER_CEILING_OF (start);
|
|
3979 ceiling = min (limit, ceiling);
|
|
3980 ceiling_addr = &FETCH_CHAR (ceiling) + 1;
|
|
3981 base = (cursor = &FETCH_CHAR (start));
|
|
3982 while (1)
|
|
3983 {
|
|
3984 while (*cursor != '\n' && *cursor != 015 && ++cursor != ceiling_addr)
|
|
3985 ;
|
|
3986 if (cursor != ceiling_addr)
|
|
3987 {
|
|
3988 if (--count == 0)
|
|
3989 {
|
|
3990 immediate_quit = 0;
|
|
3991 return (start + cursor - base + 1);
|
|
3992 }
|
|
3993 else
|
|
3994 if (++cursor == ceiling_addr)
|
|
3995 break;
|
|
3996 }
|
|
3997 else
|
|
3998 break;
|
|
3999 }
|
|
4000 start += cursor - base;
|
|
4001 }
|
|
4002 else
|
|
4003 {
|
|
4004 start--; /* first character we scan */
|
|
4005 while (start > limit - 1)
|
|
4006 { /* we WILL scan under start */
|
|
4007 ceiling = BUFFER_FLOOR_OF (start);
|
|
4008 ceiling = max (limit, ceiling);
|
|
4009 ceiling_addr = &FETCH_CHAR (ceiling) - 1;
|
|
4010 base = (cursor = &FETCH_CHAR (start));
|
|
4011 cursor++;
|
|
4012 while (1)
|
|
4013 {
|
|
4014 while (--cursor != ceiling_addr
|
|
4015 && *cursor != '\n' && *cursor != 015)
|
|
4016 ;
|
|
4017 if (cursor != ceiling_addr)
|
|
4018 {
|
|
4019 if (++count == 0)
|
|
4020 {
|
|
4021 immediate_quit = 0;
|
|
4022 return (start + cursor - base + 1);
|
|
4023 }
|
|
4024 }
|
|
4025 else
|
|
4026 break;
|
|
4027 }
|
|
4028 start += cursor - base;
|
|
4029 }
|
|
4030 }
|
|
4031
|
|
4032 if (shortage != 0)
|
|
4033 *shortage = count * direction;
|
|
4034 return (start + ((direction == 1 ? 0 : 1)));
|
|
4035 }
|
2303
|
4036
|
|
4037 /* Count up to N lines starting from FROM.
|
|
4038 But don't go beyond LIMIT.
|
|
4039 Return the number of lines thus found (always positive).
|
|
4040 Store the position after what was found into *POS_PTR. */
|
|
4041
|
|
4042 static int
|
|
4043 display_count_lines (from, limit, n, pos_ptr)
|
|
4044 int from, limit, n;
|
|
4045 int *pos_ptr;
|
|
4046 {
|
|
4047 int oldbegv = BEGV;
|
|
4048 int oldzv = ZV;
|
|
4049 int shortage = 0;
|
|
4050
|
|
4051 if (limit < from)
|
|
4052 BEGV = limit;
|
|
4053 else
|
|
4054 ZV = limit;
|
|
4055
|
8622
|
4056 *pos_ptr = display_scan_buffer (from, n, &shortage);
|
2303
|
4057
|
|
4058 ZV = oldzv;
|
|
4059 BEGV = oldbegv;
|
|
4060
|
|
4061 if (n < 0)
|
|
4062 /* When scanning backwards, scan_buffer stops *after* the last newline
|
|
4063 it finds, but does count it. Compensate for that. */
|
|
4064 return - n - shortage - (*pos_ptr != limit);
|
|
4065 return n - shortage;
|
|
4066 }
|
277
|
4067
|
|
4068 /* Display STRING on one line of window W, starting at HPOS.
|
|
4069 Display at position VPOS. Caller should have done get_display_line.
|
1017
|
4070 If VPOS == -1, display it as the current frame's title.
|
5230
|
4071 LENGTH is the length of STRING, or -1 meaning STRING is null-terminated.
|
277
|
4072
|
|
4073 TRUNCATE is GLYPH to display at end if truncated. Zero for none.
|
|
4074
|
|
4075 MINCOL is the first column ok to end at. (Pad with spaces to this col.)
|
|
4076 MAXCOL is the last column ok to end at. Truncate here.
|
|
4077 -1 for MINCOL or MAXCOL means no explicit minimum or maximum.
|
769
|
4078 Both count from the left edge of the frame, as does HPOS.
|
277
|
4079 The right edge of W is an implicit maximum.
|
|
4080 If TRUNCATE is nonzero, the implicit maximum is one column before the edge.
|
|
4081
|
5800
|
4082 OBEY_WINDOW_WIDTH says to put spaces or vertical bars
|
|
4083 at the place where the current window ends in this line
|
|
4084 and not display anything beyond there. Otherwise, only MAXCOL
|
|
4085 controls where to stop output.
|
|
4086
|
|
4087 Returns ending hpos. */
|
277
|
4088
|
|
4089 static int
|
5800
|
4090 display_string (w, vpos, string, length, hpos, truncate,
|
|
4091 obey_window_width, mincol, maxcol)
|
277
|
4092 struct window *w;
|
|
4093 unsigned char *string;
|
5230
|
4094 int length;
|
277
|
4095 int vpos, hpos;
|
|
4096 GLYPH truncate;
|
5800
|
4097 int obey_window_width;
|
277
|
4098 int mincol, maxcol;
|
|
4099 {
|
|
4100 register int c;
|
13459
|
4101 int truncated;
|
277
|
4102 register GLYPH *p1;
|
|
4103 int hscroll = XINT (w->hscroll);
|
1600
|
4104 int tab_width = XINT (XBUFFER (w->buffer)->tab_width);
|
277
|
4105 register GLYPH *start;
|
|
4106 register GLYPH *end;
|
1785
|
4107 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
|
|
4108 struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f);
|
277
|
4109 GLYPH *p1start = desired_glyphs->glyphs[vpos] + hpos;
|
|
4110 int window_width = XFASTINT (w->width);
|
|
4111
|
|
4112 /* Use the standard display table, not the window's display table.
|
|
4113 We don't want the mode line in rot13. */
|
13188
|
4114 register struct Lisp_Char_Table *dp = 0;
|
6612
|
4115 int i;
|
277
|
4116
|
13188
|
4117 if (DISP_TABLE_P (Vstandard_display_table))
|
|
4118 dp = XCHAR_TABLE (Vstandard_display_table);
|
277
|
4119
|
2324
24cd3df6f184
(display_string, display_text_line): Allow tab_width up to 1000.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4120 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
|
277
|
4121
|
|
4122 p1 = p1start;
|
|
4123 start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left);
|
5800
|
4124
|
|
4125 if (obey_window_width)
|
1785
|
4126 {
|
5800
|
4127 end = start + window_width - (truncate != 0);
|
|
4128
|
|
4129 if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f))
|
1785
|
4130 {
|
5800
|
4131 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
|
|
4132 {
|
|
4133 int i;
|
|
4134
|
8943
a9e40d478857
(display_string): Change VERTICAL_SCROLL_BAR_WIDTH to FRAME_SCROLL_BAR_COLS.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4135 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++)
|
5800
|
4136 *end-- = ' ';
|
|
4137 }
|
|
4138 else
|
|
4139 *end-- = '|';
|
1785
|
4140 }
|
|
4141 }
|
277
|
4142
|
5800
|
4143 if (! obey_window_width
|
|
4144 || (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol))
|
277
|
4145 end = desired_glyphs->glyphs[vpos] + maxcol;
|
5800
|
4146
|
6612
|
4147 /* Store 0 in charstart for these columns. */
|
6704
|
4148 for (i = (hpos >= 0 ? hpos : 0); i < end - p1start + hpos; i++)
|
6612
|
4149 desired_glyphs->charstarts[vpos][i] = 0;
|
|
4150
|
277
|
4151 if (maxcol >= 0 && mincol > maxcol)
|
|
4152 mincol = maxcol;
|
|
4153
|
13459
|
4154 /* We set truncated to 1 if we get stopped by trying to pass END
|
|
4155 (that is, trying to pass MAXCOL.) */
|
|
4156 truncated = 0;
|
|
4157 while (1)
|
277
|
4158 {
|
5230
|
4159 if (length == 0)
|
|
4160 break;
|
277
|
4161 c = *string++;
|
5230
|
4162 /* Specified length. */
|
|
4163 if (length >= 0)
|
|
4164 length--;
|
|
4165 /* Unspecified length (null-terminated string). */
|
|
4166 else if (c == 0)
|
|
4167 break;
|
|
4168
|
13459
|
4169 if (p1 >= end)
|
|
4170 {
|
|
4171 truncated = 1;
|
|
4172 break;
|
|
4173 }
|
|
4174
|
10822
|
4175 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
|
|
4176 {
|
|
4177 p1 = copy_part_of_rope (f, p1, start,
|
|
4178 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents,
|
|
4179 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size,
|
|
4180 0);
|
|
4181 }
|
|
4182 else if (c >= 040 && c < 0177)
|
277
|
4183 {
|
|
4184 if (p1 >= start)
|
|
4185 *p1 = c;
|
|
4186 p1++;
|
|
4187 }
|
|
4188 else if (c == '\t')
|
|
4189 {
|
|
4190 do
|
|
4191 {
|
|
4192 if (p1 >= start && p1 < end)
|
|
4193 *p1 = SPACEGLYPH;
|
|
4194 p1++;
|
|
4195 }
|
|
4196 while ((p1 - start + hscroll - (hscroll > 0)) % tab_width);
|
|
4197 }
|
1527
|
4198 else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow))
|
277
|
4199 {
|
|
4200 if (p1 >= start)
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4201 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
|
5800
|
4202 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
|
|
4203 0);
|
277
|
4204 p1++;
|
368
|
4205 if (p1 >= start && p1 < end)
|
277
|
4206 *p1 = c ^ 0100;
|
|
4207 p1++;
|
|
4208 }
|
|
4209 else
|
|
4210 {
|
|
4211 if (p1 >= start)
|
9104
610e18fd64a9
(redisplay, mark_window_display_accurate, try_window_id, display_text_line,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4212 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
|
5800
|
4213 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
|
|
4214 0);
|
277
|
4215 p1++;
|
368
|
4216 if (p1 >= start && p1 < end)
|
277
|
4217 *p1 = (c >> 6) + '0';
|
|
4218 p1++;
|
368
|
4219 if (p1 >= start && p1 < end)
|
277
|
4220 *p1 = (7 & (c >> 3)) + '0';
|
|
4221 p1++;
|
368
|
4222 if (p1 >= start && p1 < end)
|
277
|
4223 *p1 = (7 & c) + '0';
|
|
4224 p1++;
|
|
4225 }
|
|
4226 }
|
|
4227
|
13459
|
4228 if (truncated)
|
277
|
4229 {
|
|
4230 p1 = end;
|
5800
|
4231 if (truncate) *p1++ = fix_glyph (f, truncate, 0);
|
277
|
4232 }
|
|
4233 else if (mincol >= 0)
|
|
4234 {
|
|
4235 end = desired_glyphs->glyphs[vpos] + mincol;
|
|
4236 while (p1 < end)
|
|
4237 *p1++ = SPACEGLYPH;
|
|
4238 }
|
|
4239
|
|
4240 {
|
|
4241 register int len = p1 - desired_glyphs->glyphs[vpos];
|
|
4242
|
|
4243 if (len > desired_glyphs->used[vpos])
|
|
4244 desired_glyphs->used[vpos] = len;
|
|
4245 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0;
|
|
4246
|
|
4247 return len;
|
|
4248 }
|
|
4249 }
|
|
4250
|
10965
|
4251 /* This is like a combination of memq and assq.
|
|
4252 Return 1 if PROPVAL appears as an element of LIST
|
|
4253 or as the car of an element of LIST.
|
11066
|
4254 If PROPVAL is a list, compare each element against LIST
|
|
4255 in that way, and return 1 if any element of PROPVAL is found in LIST.
|
10965
|
4256 Otherwise return 0.
|
|
4257 This function cannot quit. */
|
|
4258
|
|
4259 int
|
|
4260 invisible_p (propval, list)
|
|
4261 register Lisp_Object propval;
|
|
4262 Lisp_Object list;
|
|
4263 {
|
11066
|
4264 register Lisp_Object tail, proptail;
|
|
4265 for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr)
|
10965
|
4266 {
|
|
4267 register Lisp_Object tem;
|
11066
|
4268 tem = XCONS (tail)->car;
|
10965
|
4269 if (EQ (propval, tem))
|
|
4270 return 1;
|
|
4271 if (CONSP (tem) && EQ (propval, XCONS (tem)->car))
|
|
4272 return 1;
|
|
4273 }
|
11066
|
4274 if (CONSP (propval))
|
|
4275 for (proptail = propval; CONSP (proptail);
|
|
4276 proptail = XCONS (proptail)->cdr)
|
|
4277 {
|
|
4278 Lisp_Object propelt;
|
|
4279 propelt = XCONS (proptail)->car;
|
|
4280 for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr)
|
|
4281 {
|
|
4282 register Lisp_Object tem;
|
|
4283 tem = XCONS (tail)->car;
|
|
4284 if (EQ (propelt, tem))
|
|
4285 return 1;
|
|
4286 if (CONSP (tem) && EQ (propelt, XCONS (tem)->car))
|
|
4287 return 1;
|
|
4288 }
|
|
4289 }
|
10965
|
4290 return 0;
|
|
4291 }
|
|
4292
|
|
4293 /* Return 1 if PROPVAL appears as the car of an element of LIST
|
|
4294 and the cdr of that element is non-nil.
|
11066
|
4295 If PROPVAL is a list, check each element of PROPVAL in that way,
|
|
4296 and the first time some element is found,
|
|
4297 return 1 if the cdr of that element is non-nil.
|
10965
|
4298 Otherwise return 0.
|
|
4299 This function cannot quit. */
|
|
4300
|
|
4301 int
|
|
4302 invisible_ellipsis_p (propval, list)
|
|
4303 register Lisp_Object propval;
|
|
4304 Lisp_Object list;
|
|
4305 {
|
11066
|
4306 register Lisp_Object tail, proptail;
|
|
4307 for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr)
|
10965
|
4308 {
|
|
4309 register Lisp_Object tem;
|
11066
|
4310 tem = XCONS (tail)->car;
|
10965
|
4311 if (CONSP (tem) && EQ (propval, XCONS (tem)->car))
|
|
4312 return ! NILP (XCONS (tem)->cdr);
|
|
4313 }
|
11066
|
4314 if (CONSP (propval))
|
|
4315 for (proptail = propval; CONSP (proptail);
|
|
4316 proptail = XCONS (proptail)->cdr)
|
|
4317 {
|
|
4318 Lisp_Object propelt;
|
|
4319 propelt = XCONS (proptail)->car;
|
|
4320 for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr)
|
|
4321 {
|
|
4322 register Lisp_Object tem;
|
|
4323 tem = XCONS (tail)->car;
|
|
4324 if (CONSP (tem) && EQ (propelt, XCONS (tem)->car))
|
|
4325 return ! NILP (XCONS (tem)->cdr);
|
|
4326 }
|
|
4327 }
|
10965
|
4328 return 0;
|
|
4329 }
|
|
4330
|
277
|
4331 void
|
|
4332 syms_of_xdisp ()
|
|
4333 {
|
7096
|
4334 staticpro (&Qmenu_bar_update_hook);
|
|
4335 Qmenu_bar_update_hook = intern ("menu-bar-update-hook");
|
|
4336
|
12263
|
4337 staticpro (&Qoverriding_terminal_local_map);
|
12267
|
4338 Qoverriding_terminal_local_map = intern ("overriding-terminal-local-map");
|
12263
|
4339
|
12171
|
4340 staticpro (&Qoverriding_local_map);
|
|
4341 Qoverriding_local_map = intern ("overriding-local-map");
|
|
4342
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4343 staticpro (&Qwindow_scroll_functions);
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4344 Qwindow_scroll_functions = intern ("window-scroll-functions");
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4345
|
13584
|
4346 staticpro (&Qredisplay_end_trigger_functions);
|
|
4347 Qredisplay_end_trigger_functions = intern ("redisplay-end-trigger-functions");
|
13266
|
4348
|
277
|
4349 staticpro (&last_arrow_position);
|
|
4350 staticpro (&last_arrow_string);
|
|
4351 last_arrow_position = Qnil;
|
|
4352 last_arrow_string = Qnil;
|
|
4353
|
|
4354 DEFVAR_LISP ("global-mode-string", &Vglobal_mode_string,
|
782
|
4355 "String (or mode line construct) included (normally) in `mode-line-format'.");
|
277
|
4356 Vglobal_mode_string = Qnil;
|
|
4357
|
|
4358 DEFVAR_LISP ("overlay-arrow-position", &Voverlay_arrow_position,
|
|
4359 "Marker for where to display an arrow on top of the buffer text.\n\
|
|
4360 This must be the beginning of a line in order to work.\n\
|
|
4361 See also `overlay-arrow-string'.");
|
|
4362 Voverlay_arrow_position = Qnil;
|
|
4363
|
|
4364 DEFVAR_LISP ("overlay-arrow-string", &Voverlay_arrow_string,
|
|
4365 "String to display as an arrow. See also `overlay-arrow-position'.");
|
|
4366 Voverlay_arrow_string = Qnil;
|
|
4367
|
|
4368 DEFVAR_INT ("scroll-step", &scroll_step,
|
|
4369 "*The number of lines to try scrolling a window by when point moves out.\n\
|
769
|
4370 If that fails to bring point back on frame, point is centered instead.\n\
|
|
4371 If this is zero, point is always centered after it moves off frame.");
|
277
|
4372
|
|
4373 DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask");
|
|
4374
|
|
4375 DEFVAR_BOOL ("truncate-partial-width-windows",
|
|
4376 &truncate_partial_width_windows,
|
769
|
4377 "*Non-nil means truncate lines in all windows less than full frame wide.");
|
277
|
4378 truncate_partial_width_windows = 1;
|
|
4379
|
|
4380 DEFVAR_BOOL ("mode-line-inverse-video", &mode_line_inverse_video,
|
|
4381 "*Non-nil means use inverse video for the mode line.");
|
|
4382 mode_line_inverse_video = 1;
|
2303
|
4383
|
|
4384 DEFVAR_INT ("line-number-display-limit", &line_number_display_limit,
|
|
4385 "*Maximum buffer size for which line number should be displayed.");
|
|
4386 line_number_display_limit = 1000000;
|
3265
|
4387
|
|
4388 DEFVAR_BOOL ("highlight-nonselected-windows", &highlight_nonselected_windows,
|
|
4389 "*Non-nil means highlight region even in nonselected windows.");
|
|
4390 highlight_nonselected_windows = 1;
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4391
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4392 DEFVAR_BOOL ("multiple-frames", &multiple_frames,
|
11767
|
4393 "Non-nil if more than one frame is visible on this display.\n\
|
|
4394 Minibuffer-only frames don't count, but iconified frames do.\n\
|
12684
|
4395 This variable is not guaranteed to be accurate except while processing\n\
|
|
4396 `frame-title-format' and `icon-title-format'.");
|
8772
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4397
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4398 DEFVAR_LISP ("frame-title-format", &Vframe_title_format,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4399 "Template for displaying the titlebar of visible frames.\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4400 \(Assuming the window manager supports this feature.)\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4401 This variable has the same structure as `mode-line-format' (which see),\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4402 and is used only on frames for which no explicit name has been set\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4403 \(see `modify-frame-parameters').");
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4404 DEFVAR_LISP ("icon-title-format", &Vicon_title_format,
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4405 "Template for displaying the titlebar of an iconified frame.\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4406 \(Assuming the window manager supports this feature.)\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4407 This variable has the same structure as `mode-line-format' (which see),\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4408 and is used only on frames for which no explicit name has been set\n\
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4409 \(see `modify-frame-parameters').");
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4410 Vicon_title_format
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4411 = Vframe_title_format
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4412 = Fcons (intern ("multiple-frames"),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4413 Fcons (build_string ("%b"),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4414 Fcons (Fcons (build_string (""),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4415 Fcons (intern ("invocation-name"),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4416 Fcons (build_string ("@"),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4417 Fcons (intern ("system-name"),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4418 Qnil)))),
|
c0a21329d9a7
(multiple_frames, Vframe_title_format, Vicon_title_format): New variables.
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4419 Qnil)));
|
10393
|
4420
|
|
4421 DEFVAR_LISP ("message-log-max", &Vmessage_log_max,
|
|
4422 "Maximum number of lines to keep in the message log buffer.\n\
|
|
4423 If nil, disable message logging. If t, log messages but don't truncate\n\
|
|
4424 the buffer when it becomes large.");
|
|
4425 XSETFASTINT (Vmessage_log_max, 50);
|
10667
|
4426
|
|
4427 DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions,
|
|
4428 "Functions called before redisplay, if window sizes have changed.\n\
|
|
4429 The value should be a list of functions that take one argument.\n\
|
|
4430 Just before redisplay, for each frame, if any of its windows have changed\n\
|
|
4431 size since the last redisplay, or have been split or deleted,\n\
|
|
4432 all the functions in the list are called, with the frame as argument.");
|
|
4433 Vwindow_size_change_functions = Qnil;
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4434
|
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4435 DEFVAR_LISP ("window-scroll-functions", &Vwindow_scroll_functions,
|
13188
|
4436 "List of Functions to call before redisplaying a window with scrolling.\n\
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4437 Each function is called with two arguments, the window\n\
|
13196
|
4438 and its new display-start position. Note that the value of `window-end'\n\
|
|
4439 is not valid when these functions are called.");
|
13104
ea64c261c72a
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
4440 Vwindow_scroll_functions = Qnil;
|
277
|
4441 }
|
|
4442
|
|
4443 /* initialize the window system */
|
|
4444 init_xdisp ()
|
|
4445 {
|
|
4446 Lisp_Object root_window;
|
|
4447 #ifndef COMPILER_REGISTER_BUG
|
|
4448 register
|
|
4449 #endif /* COMPILER_REGISTER_BUG */
|
|
4450 struct window *mini_w;
|
|
4451
|
|
4452 this_line_bufpos = 0;
|
|
4453
|
|
4454 mini_w = XWINDOW (minibuf_window);
|
1017
|
4455 root_window = FRAME_ROOT_WINDOW (XFRAME (WINDOW_FRAME (mini_w)));
|
277
|
4456
|
|
4457 echo_area_glyphs = 0;
|
|
4458 previous_echo_glyphs = 0;
|
|
4459
|
|
4460 if (!noninteractive)
|
|
4461 {
|
769
|
4462 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (root_window)));
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4463 XSETFASTINT (XWINDOW (root_window)->top, 0);
|
769
|
4464 set_window_height (root_window, FRAME_HEIGHT (f) - 1, 0);
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4465 XSETFASTINT (mini_w->top, FRAME_HEIGHT (f) - 1);
|
277
|
4466 set_window_height (minibuf_window, 1, 0);
|
|
4467
|
9325
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4468 XSETFASTINT (XWINDOW (root_window)->width, FRAME_WIDTH (f));
|
6f07f6dfe1ee
(redisplay, mark_window_display_accurate, redisplay_window, try_window,
Karl Heuer <kwzh@gnu.org>
diff
changeset
|
4469 XSETFASTINT (mini_w->width, FRAME_WIDTH (f));
|
277
|
4470 }
|
|
4471 }
|