Mercurial > emacs
annotate src/xdisp.c @ 6630:cd036c4e1dfd
(update_menu_bar): Pass 0 to set_frame_menubar.
| author | Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr> |
|---|---|
| date | Fri, 01 Apr 1994 13:43:24 +0000 |
| parents | c359dfd21b00 |
| children | 07be9ae289ce |
| rev | line source |
|---|---|
| 277 | 1 /* Display generation from window structure and buffer text. |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2 Copyright (C) 1985, 86, 87, 88, 93, 94 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
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
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 | |
| 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
| 19 | |
| 20 | |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4423
diff
changeset
|
21 #include <config.h> |
| 277 | 22 #include <stdio.h> |
| 23 /*#include <ctype.h>*/ | |
| 24 #undef NULL | |
| 25 #include "lisp.h" | |
| 769 | 26 #include "frame.h" |
| 277 | 27 #include "window.h" |
| 28 #include "termchar.h" | |
| 29 #include "dispextern.h" | |
| 30 #include "buffer.h" | |
| 31 #include "indent.h" | |
| 32 #include "commands.h" | |
| 33 #include "macros.h" | |
| 34 #include "disptab.h" | |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
35 #include "termhooks.h" |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
36 #include "intervals.h" |
| 277 | 37 |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
38 #ifdef USE_X_TOOLKIT |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
39 extern void set_frame_menubar (); |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
40 #endif |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
41 |
| 277 | 42 extern int interrupt_input; |
| 43 extern int command_loop_level; | |
| 44 | |
| 45 /* Nonzero means print newline before next minibuffer message. */ | |
| 46 | |
| 47 int noninteractive_need_newline; | |
| 48 | |
| 49 #define min(a, b) ((a) < (b) ? (a) : (b)) | |
| 50 #define max(a, b) ((a) > (b) ? (a) : (b)) | |
| 51 | |
| 52 /* The buffer position of the first character appearing | |
| 769 | 53 entirely or partially on the current frame line. |
| 54 Or zero, which disables the optimization for the current frame line. */ | |
| 277 | 55 static int this_line_bufpos; |
| 56 | |
| 57 /* Number of characters past the end of this line, | |
| 58 including the terminating newline */ | |
| 59 static int this_line_endpos; | |
| 60 | |
| 769 | 61 /* The vertical position of this frame line. */ |
| 277 | 62 static int this_line_vpos; |
| 63 | |
| 769 | 64 /* Hpos value for start of display on this frame line. |
| 277 | 65 Usually zero, but negative if first character really began |
| 66 on previous line */ | |
| 67 static int this_line_start_hpos; | |
| 68 | |
| 69 /* Buffer that this_line variables are describing. */ | |
| 70 static struct buffer *this_line_buffer; | |
| 71 | |
| 72 /* Set by try_window_id to the vpos of first of any lines | |
| 769 | 73 scrolled on to the bottom of the frame. These lines should |
| 277 | 74 not be included in any general scroll computation. */ |
| 75 static int scroll_bottom_vpos; | |
| 76 | |
| 77 /* Value of echo_area_glyphs when it was last acted on. | |
| 769 | 78 If this is nonzero, there is a message on the frame |
| 277 | 79 in the minibuffer and it should be erased as soon |
| 80 as it is no longer requested to appear. */ | |
| 81 char *previous_echo_glyphs; | |
| 82 | |
| 769 | 83 /* Nonzero means truncate lines in all windows less wide than the frame */ |
| 277 | 84 int truncate_partial_width_windows; |
| 85 | |
| 86 Lisp_Object Vglobal_mode_string; | |
| 87 | |
| 88 /* Marker for where to display an arrow on top of the buffer text. */ | |
| 89 Lisp_Object Voverlay_arrow_position; | |
| 90 | |
| 91 /* String to display for the arrow. */ | |
| 92 Lisp_Object Voverlay_arrow_string; | |
| 93 | |
| 94 /* Values of those variables at last redisplay. */ | |
|
1527
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
95 static Lisp_Object last_arrow_position, last_arrow_string; |
| 277 | 96 |
| 97 /* Nonzero if overlay arrow has been displayed once in this window. */ | |
| 98 static int overlay_arrow_seen; | |
| 99 | |
|
3265
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
100 /* Nonzero means highlight the region even in nonselected windows. */ |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
101 static int highlight_nonselected_windows; |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
102 |
| 769 | 103 /* If cursor motion alone moves point off frame, |
| 277 | 104 Try scrolling this many lines up or down if that will bring it back. */ |
| 105 int scroll_step; | |
| 106 | |
| 107 /* Nonzero if try_window_id has made blank lines at window bottom | |
| 108 since the last redisplay that paused */ | |
| 109 static int blank_end_of_window; | |
| 110 | |
| 111 /* Number of windows showing the buffer of the selected window. | |
| 112 keyboard.c refers to this. */ | |
| 113 int buffer_shared; | |
| 114 | |
| 769 | 115 /* display_text_line sets these to the frame position (origin 0) of point, |
| 277 | 116 whether the window is selected or not. |
| 117 Set one to -1 first to determine whether point was found afterwards. */ | |
| 118 | |
| 119 static int cursor_vpos; | |
| 120 static int cursor_hpos; | |
| 121 | |
| 122 int debug_end_pos; | |
| 123 | |
| 124 /* Nonzero means display mode line highlighted */ | |
| 125 int mode_line_inverse_video; | |
| 126 | |
| 127 static void echo_area_display (); | |
| 128 void mark_window_display_accurate (); | |
| 129 static void redisplay_windows (); | |
| 130 static void redisplay_window (); | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
131 static void update_menu_bars (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
132 static void update_menu_bar (); |
| 277 | 133 static void try_window (); |
| 134 static int try_window_id (); | |
| 135 static struct position *display_text_line (); | |
| 136 static void display_mode_line (); | |
| 137 static int display_mode_element (); | |
| 138 static char *fmodetrunc (); | |
| 139 static char *decode_mode_spec (); | |
| 140 static int display_string (); | |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
141 static void display_menu_bar (); |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
142 static int display_count_lines (); |
| 277 | 143 |
| 144 /* Prompt to display in front of the minibuffer contents */ | |
| 145 char *minibuf_prompt; | |
| 146 | |
| 147 /* Width in columns of current minibuffer prompt. */ | |
| 148 int minibuf_prompt_width; | |
| 149 | |
| 150 /* Message to display instead of minibuffer contents | |
| 151 This is what the functions error and message make, | |
| 152 and command echoing uses it as well. | |
| 153 It overrides the minibuf_prompt as well as the buffer. */ | |
| 154 char *echo_area_glyphs; | |
| 155 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
156 /* This is the length of the message in echo_area_glyphs. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
157 int echo_area_glyphs_length; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
158 |
| 277 | 159 /* true iff we should redraw the mode lines on the next redisplay */ |
| 160 int update_mode_lines; | |
| 161 | |
| 162 /* Smallest number of characters before the gap | |
| 163 at any time since last redisplay that finished. | |
| 164 Valid for current buffer when try_window_id can be called. */ | |
| 165 int beg_unchanged; | |
| 166 | |
| 167 /* Smallest number of characters after the gap | |
| 168 at any time since last redisplay that finished. | |
| 169 Valid for current buffer when try_window_id can be called. */ | |
| 170 int end_unchanged; | |
| 171 | |
| 172 /* MODIFF as of last redisplay that finished; | |
| 173 if it matches MODIFF, beg_unchanged and end_unchanged | |
| 174 contain no useful information */ | |
| 175 int unchanged_modified; | |
| 176 | |
| 177 /* Nonzero if head_clip or tail_clip of current buffer has changed | |
| 178 since last redisplay that finished */ | |
| 179 int clip_changed; | |
| 180 | |
| 181 /* Nonzero if window sizes or contents have changed | |
| 182 since last redisplay that finished */ | |
| 183 int windows_or_buffers_changed; | |
| 184 | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
185 /* Nonzero after display_mode_line if %l was used |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
186 and it displayed a line number. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
187 int line_number_displayed; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
188 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
189 /* Maximum buffer size for which to display line numbers. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
190 int line_number_display_limit; |
| 277 | 191 |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
192 /* Display an echo area message M with a specified length of LEN chars. |
|
6366
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
193 The string may include null characters. If m is 0, clear out any |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
194 existing message, and let the minibuffer text show through. |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
195 Do not pass text that is stored in a Lisp string. */ |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
196 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
197 void |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
198 message2 (m, len) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
199 char *m; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
200 int len; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
201 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
202 if (noninteractive) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
203 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
204 if (noninteractive_need_newline) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
205 putc ('\n', stderr); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
206 noninteractive_need_newline = 0; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
207 fwrite (m, len, 1, stderr); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
208 if (cursor_in_echo_area == 0) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
209 fprintf (stderr, "\n"); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
210 fflush (stderr); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
211 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
212 /* A null message buffer means that the frame hasn't really been |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
213 initialized yet. Error messages get reported properly by |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
214 cmd_error, so this must be just an informative message; toss it. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
215 else if (INTERACTIVE && FRAME_MESSAGE_BUF (selected_frame)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
216 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
217 #ifdef MULTI_FRAME |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
218 Lisp_Object minibuf_frame; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
219 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
220 choose_minibuf_frame (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
221 minibuf_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
222 FRAME_SAMPLE_VISIBILITY (XFRAME (minibuf_frame)); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
223 if (FRAME_VISIBLE_P (selected_frame) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
224 && ! FRAME_VISIBLE_P (XFRAME (minibuf_frame))) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
225 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (minibuf_window))); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
226 #endif |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
227 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
228 if (m) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
229 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
230 echo_area_glyphs = m; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
231 echo_area_glyphs_length = len; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
232 } |
|
1527
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
233 else |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
234 echo_area_glyphs = previous_echo_glyphs = 0; |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
235 |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
236 do_pending_window_change (); |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
237 echo_area_display (); |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
238 update_frame (XFRAME (XWINDOW (minibuf_window)->frame), 1, 1); |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
239 do_pending_window_change (); |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
240 } |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
241 } |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
242 |
|
6366
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
243 void |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
244 message1 (m) |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
245 char *m; |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
246 { |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
247 message2 (m, (m ? strlen (m) : 0)); |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
248 } |
|
6f28d7614611
(message1): Call message2 instead of duplicating code.
Karl Heuer <kwzh@gnu.org>
parents:
6342
diff
changeset
|
249 |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
250 /* Truncate what will be displayed in the echo area |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
251 the next time we display it--but don't redisplay it now. */ |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
252 |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
253 void |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
254 truncate_echo_area (len) |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
255 int len; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
256 { |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
257 /* A null message buffer means that the frame hasn't really been |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
258 initialized yet. Error messages get reported properly by |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
259 cmd_error, so this must be just an informative message; toss it. */ |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
260 if (!noninteractive && INTERACTIVE && FRAME_MESSAGE_BUF (selected_frame)) |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
261 echo_area_glyphs_length = len; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
262 } |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
263 |
| 769 | 264 /* Nonzero if FRAME_MESSAGE_BUF (selected_frame) is being used by print; |
| 331 | 265 zero if being used by message. */ |
| 266 int message_buf_print; | |
| 267 | |
|
1446
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
268 /* Dump an informative message to the minibuf. If m is 0, clear out |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
269 any existing message, and let the minibuffer text show through. */ |
| 277 | 270 /* VARARGS 1 */ |
| 271 void | |
| 272 message (m, a1, a2, a3) | |
| 273 char *m; | |
| 274 { | |
| 275 if (noninteractive) | |
| 276 { | |
|
1446
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
277 if (m) |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
278 { |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
279 if (noninteractive_need_newline) |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
280 putc ('\n', stderr); |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
281 noninteractive_need_newline = 0; |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
282 fprintf (stderr, m, a1, a2, a3); |
|
2526
bcba821c17bc
(message, message1): If noninteractive and
Richard M. Stallman <rms@gnu.org>
parents:
2324
diff
changeset
|
283 if (cursor_in_echo_area == 0) |
|
bcba821c17bc
(message, message1): If noninteractive and
Richard M. Stallman <rms@gnu.org>
parents:
2324
diff
changeset
|
284 fprintf (stderr, "\n"); |
|
1446
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
285 fflush (stderr); |
|
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
286 } |
| 277 | 287 } |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
288 else if (INTERACTIVE) |
| 277 | 289 { |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
290 /* The frame whose minibuffer we're going to display the message on. |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
291 It may be larger than the selected frame, so we need |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
292 to use its buffer, not the selected frame's buffer. */ |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
293 FRAME_PTR echo_frame; |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
294 #ifdef MULTI_FRAME |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
295 choose_minibuf_frame (); |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
296 echo_frame = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
297 #else |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
298 echo_frame = selected_frame; |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
299 #endif |
| 277 | 300 |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
301 /* A null message buffer means that the frame hasn't really been |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
302 initialized yet. Error messages get reported properly by |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
303 cmd_error, so this must be just an informative message; toss it. */ |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
304 if (FRAME_MESSAGE_BUF (echo_frame)) |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
305 { |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
306 if (m) |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
307 { |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
308 int len; |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
309 #ifdef NO_ARG_ARRAY |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
310 int a[3]; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
311 a[0] = a1; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
312 a[1] = a2; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
313 a[2] = a3; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
314 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
315 len = doprnt (FRAME_MESSAGE_BUF (echo_frame), |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
316 FRAME_WIDTH (echo_frame), m, 0, 3, a); |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
317 #else |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
318 len = doprnt (FRAME_MESSAGE_BUF (echo_frame), |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
319 FRAME_WIDTH (echo_frame), m, 0, 3, &a1); |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
320 #endif /* NO_ARG_ARRAY */ |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
321 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
322 message2 (FRAME_MESSAGE_BUF (echo_frame), len); |
|
1873
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
323 } |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
324 else |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
325 message1 (0); |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
326 |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
327 /* Print should start at the beginning of the message |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
328 buffer next time. */ |
|
c5038f47c602
* xdisp.c (message): Set echo_frame to the frame whose message buf
Jim Blandy <jimb@redhat.com>
parents:
1785
diff
changeset
|
329 message_buf_print = 0; |
|
1446
37b3c2981b40
* xdisp.c (message): If M is zero, clear echo_area_glyphs and
Jim Blandy <jimb@redhat.com>
parents:
1124
diff
changeset
|
330 } |
| 277 | 331 } |
| 332 } | |
| 333 | |
| 334 static void | |
| 335 echo_area_display () | |
| 336 { | |
| 337 register int vpos; | |
| 769 | 338 FRAME_PTR f; |
| 277 | 339 |
| 769 | 340 #ifdef MULTI_FRAME |
| 341 choose_minibuf_frame (); | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
342 #endif |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
343 |
| 769 | 344 f = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 277 | 345 |
| 769 | 346 if (! FRAME_VISIBLE_P (f)) |
| 277 | 347 return; |
| 348 | |
| 769 | 349 if (frame_garbaged) |
| 277 | 350 { |
|
3516
f1ca34ddfd84
(redisplay, echo_area_display): Use redraw_garbaged_frames.
Richard M. Stallman <rms@gnu.org>
parents:
3266
diff
changeset
|
351 redraw_garbaged_frames (); |
| 769 | 352 frame_garbaged = 0; |
| 277 | 353 } |
| 354 | |
| 355 if (echo_area_glyphs || minibuf_level == 0) | |
| 356 { | |
| 357 vpos = XFASTINT (XWINDOW (minibuf_window)->top); | |
| 769 | 358 get_display_line (f, vpos, 0); |
| 277 | 359 display_string (XWINDOW (minibuf_window), vpos, |
| 360 echo_area_glyphs ? echo_area_glyphs : "", | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
361 echo_area_glyphs ? echo_area_glyphs_length : -1, |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
362 0, 0, 0, 0, FRAME_WIDTH (f)); |
| 277 | 363 |
| 364 /* If desired cursor location is on this line, put it at end of text */ | |
| 769 | 365 if (FRAME_CURSOR_Y (f) == vpos) |
| 366 FRAME_CURSOR_X (f) = FRAME_DESIRED_GLYPHS (f)->used[vpos]; | |
| 727 | 367 |
| 368 /* Fill the rest of the minibuffer window with blank lines. */ | |
| 369 { | |
| 370 int i; | |
| 371 | |
|
3689
82856e3ea14d
(echo_area_display): Use XFASTINT on ->height.
Richard M. Stallman <rms@gnu.org>
parents:
3648
diff
changeset
|
372 for (i = vpos + 1; |
|
82856e3ea14d
(echo_area_display): Use XFASTINT on ->height.
Richard M. Stallman <rms@gnu.org>
parents:
3648
diff
changeset
|
373 i < vpos + XFASTINT (XWINDOW (minibuf_window)->height); i++) |
| 727 | 374 { |
| 769 | 375 get_display_line (f, i, 0); |
| 727 | 376 display_string (XWINDOW (minibuf_window), vpos, |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
377 "", 0, 0, 0, 0, 0, FRAME_WIDTH (f)); |
| 727 | 378 } |
| 379 } | |
| 277 | 380 } |
| 381 else if (!EQ (minibuf_window, selected_window)) | |
| 382 windows_or_buffers_changed++; | |
| 383 | |
| 384 if (EQ (minibuf_window, selected_window)) | |
| 385 this_line_bufpos = 0; | |
| 386 | |
| 387 previous_echo_glyphs = echo_area_glyphs; | |
| 388 } | |
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
389 |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
390 #ifdef HAVE_X_WINDOWS |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
391 /* I'm trying this out because I saw Unimpress use it, but it's |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
392 possible that this may mess adversely with some window managers. -jla |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
393 |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
394 Wouldn't it be nice to use something like mode-line-format to |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
395 describe frame titles? -JimB */ |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
396 |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
397 /* Change the title of the frame to the name of the buffer displayed |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
398 in the currently selected window. Don't do this for minibuffer frames, |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
399 and don't do it when there's only one non-minibuffer frame. */ |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
400 static void |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
401 x_consider_frame_title (frame) |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
402 Lisp_Object frame; |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
403 { |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
404 FRAME_PTR f = XFRAME (frame); |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
405 |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
406 if (FRAME_X_P (f) && ! FRAME_MINIBUF_ONLY_P (f)) |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
407 { |
|
6518
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6415
diff
changeset
|
408 Lisp_Object title; |
|
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6415
diff
changeset
|
409 |
|
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6415
diff
changeset
|
410 title = Qnil; |
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
411 if (! EQ (Fnext_frame (frame, Qnil), frame)) |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
412 title = XBUFFER (XWINDOW (f->selected_window)->buffer)->name; |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
413 |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
414 x_implicitly_set_name (f, title, Qnil); |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
415 } |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
416 } |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
417 #endif |
| 277 | 418 |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
419 /* Prepare for redisplay by updating menu-bar item lists when appropriate. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
420 This can't be done in `redisplay' itself because it can call eval. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
421 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
422 void |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
423 prepare_menu_bars () |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
424 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
425 register struct window *w = XWINDOW (selected_window); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
426 int all_windows; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
427 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
428 if (noninteractive) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
429 return; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
430 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
431 /* Set the visible flags for all frames. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
432 Do this before checking for resized or garbaged frames; they want |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
433 to know if their frames are visible. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
434 See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
435 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
436 Lisp_Object tail, frame; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
437 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
438 FOR_EACH_FRAME (tail, frame) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
439 FRAME_SAMPLE_VISIBILITY (XFRAME (frame)); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
440 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
441 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
442 /* Notice any pending interrupt request to change frame size. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
443 do_pending_window_change (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
444 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
445 if (frame_garbaged) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
446 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
447 redraw_garbaged_frames (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
448 frame_garbaged = 0; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
449 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
450 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
451 if (clip_changed || windows_or_buffers_changed) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
452 update_mode_lines++; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
453 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
454 /* Detect case that we need to write a star in the mode line. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
455 if (XFASTINT (w->last_modified) < MODIFF |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
456 && XFASTINT (w->last_modified) <= current_buffer->save_modified) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
457 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
458 w->update_mode_line = Qt; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
459 if (buffer_shared > 1) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
460 update_mode_lines++; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
461 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
462 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
463 all_windows = update_mode_lines || buffer_shared > 1; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
464 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
465 /* If specs for an arrow have changed, do thorough redisplay |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
466 to ensure we remove any arrow that should no longer exist. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
467 if (! EQ (Voverlay_arrow_position, last_arrow_position) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
468 || ! EQ (Voverlay_arrow_string, last_arrow_string)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
469 all_windows = 1, clip_changed = 1; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
470 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
471 /* Update the menu bar item lists, if appropriate. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
472 This has to be done before any actual redisplay |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
473 or generation of display lines. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
474 if (all_windows) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
475 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
476 Lisp_Object tail, frame; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
477 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
478 FOR_EACH_FRAME (tail, frame) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
479 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
480 FRAME_PTR f = XFRAME (frame); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
481 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
482 if (FRAME_VISIBLE_P (f)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
483 update_menu_bars (FRAME_ROOT_WINDOW (f)); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
484 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
485 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
486 else if (FRAME_VISIBLE_P (selected_frame)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
487 update_menu_bar (selected_window); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
488 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
489 |
| 769 | 490 /* Do a frame update, taking possible shortcuts into account. |
| 277 | 491 This is the main external entry point for redisplay. |
| 492 | |
| 493 If the last redisplay displayed an echo area message and that | |
| 494 message is no longer requested, we clear the echo area | |
| 495 or bring back the minibuffer if that is in use. | |
| 496 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
497 Do not call eval from within this function. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
498 Calls to eval after the call to echo_area_display would confuse |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
499 the display_line mechanism and would cause a crash. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
500 Calls to eval before that point will work most of the time, |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
501 but can still lose, because this function |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
502 can be called from signal handlers; with alarms set up; |
| 277 | 503 or with synchronous processes running. |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
504 |
| 277 | 505 See Fcall_process; if you called it from here, it could be |
| 506 entered recursively. */ | |
| 507 | |
| 508 void | |
| 509 redisplay () | |
| 510 { | |
| 511 register struct window *w = XWINDOW (selected_window); | |
| 512 register int pause; | |
| 513 int must_finish = 0; | |
| 514 int all_windows; | |
| 515 register int tlbufpos, tlendpos; | |
| 516 struct position pos; | |
| 517 extern int input_pending; | |
| 518 | |
| 519 if (noninteractive) | |
| 520 return; | |
| 521 | |
|
1656
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
522 /* Set the visible flags for all frames. |
|
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
523 Do this before checking for resized or garbaged frames; they want |
|
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
524 to know if their frames are visible. |
|
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
525 See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */ |
|
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
526 { |
|
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
527 Lisp_Object tail, frame; |
|
1656
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
528 |
|
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
529 FOR_EACH_FRAME (tail, frame) |
|
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
530 FRAME_SAMPLE_VISIBILITY (XFRAME (frame)); |
|
1656
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
531 } |
|
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
532 |
| 769 | 533 /* Notice any pending interrupt request to change frame size. */ |
| 277 | 534 do_pending_window_change (); |
| 535 | |
| 769 | 536 if (frame_garbaged) |
| 277 | 537 { |
|
3516
f1ca34ddfd84
(redisplay, echo_area_display): Use redraw_garbaged_frames.
Richard M. Stallman <rms@gnu.org>
parents:
3266
diff
changeset
|
538 redraw_garbaged_frames (); |
| 769 | 539 frame_garbaged = 0; |
| 277 | 540 } |
| 541 | |
| 542 if (clip_changed || windows_or_buffers_changed) | |
| 543 update_mode_lines++; | |
| 544 | |
| 545 /* Detect case that we need to write a star in the mode line. */ | |
| 546 if (XFASTINT (w->last_modified) < MODIFF | |
| 547 && XFASTINT (w->last_modified) <= current_buffer->save_modified) | |
| 548 { | |
| 549 w->update_mode_line = Qt; | |
| 550 if (buffer_shared > 1) | |
| 551 update_mode_lines++; | |
| 552 } | |
| 553 | |
| 769 | 554 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; |
| 277 | 555 |
| 556 all_windows = update_mode_lines || buffer_shared > 1; | |
| 557 | |
| 558 /* If specs for an arrow have changed, do thorough redisplay | |
| 559 to ensure we remove any arrow that should no longer exist. */ | |
|
1527
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
560 if (! EQ (Voverlay_arrow_position, last_arrow_position) |
|
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
561 || ! EQ (Voverlay_arrow_string, last_arrow_string)) |
| 277 | 562 all_windows = 1, clip_changed = 1; |
| 563 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
564 /* Normally the message* functions will have already displayed and |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
565 updated the echo area, but the frame may have been trashed, or |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
566 the update may have been preempted, so display the echo area |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
567 again here. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
568 if (echo_area_glyphs || previous_echo_glyphs) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
569 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
570 echo_area_display (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
571 must_finish = 1; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
572 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
573 |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
574 /* If showing region, and mark has changed, must redisplay whole window. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
575 if (((!NILP (Vtransient_mark_mode) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
576 && !NILP (XBUFFER (w->buffer)->mark_active)) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
577 != !NILP (w->region_showing)) |
|
3937
adcbf7680a35
* xdisp.c (redisplay): If we're not already showing the region,
Jim Blandy <jimb@redhat.com>
parents:
3880
diff
changeset
|
578 || (!NILP (w->region_showing) |
|
adcbf7680a35
* xdisp.c (redisplay): If we're not already showing the region,
Jim Blandy <jimb@redhat.com>
parents:
3880
diff
changeset
|
579 && !EQ (w->region_showing, |
|
adcbf7680a35
* xdisp.c (redisplay): If we're not already showing the region,
Jim Blandy <jimb@redhat.com>
parents:
3880
diff
changeset
|
580 Fmarker_position (XBUFFER (w->buffer)->mark)))) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
581 this_line_bufpos = -1; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
582 |
| 277 | 583 tlbufpos = this_line_bufpos; |
| 584 tlendpos = this_line_endpos; | |
| 485 | 585 if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line) |
| 769 | 586 && FRAME_VISIBLE_P (XFRAME (w->frame)) |
| 277 | 587 /* Make sure recorded data applies to current buffer, etc */ |
| 588 && this_line_buffer == current_buffer | |
| 589 && current_buffer == XBUFFER (w->buffer) | |
| 485 | 590 && NILP (w->force_start) |
| 277 | 591 /* Point must be on the line that we have info recorded about */ |
| 592 && point >= tlbufpos | |
| 593 && point <= Z - tlendpos | |
| 594 /* All text outside that line, including its final newline, | |
| 595 must be unchanged */ | |
| 596 && (XFASTINT (w->last_modified) >= MODIFF | |
| 597 || (beg_unchanged >= tlbufpos - 1 | |
| 598 && GPT >= tlbufpos | |
| 528 | 599 /* If selective display, can't optimize |
| 600 if the changes start at the beginning of the line. */ | |
| 601 && ((XTYPE (current_buffer->selective_display) == Lisp_Int | |
| 602 && XINT (current_buffer->selective_display) > 0 | |
| 603 ? (beg_unchanged >= tlbufpos | |
| 604 && GPT > tlbufpos) | |
| 605 : 1)) | |
| 277 | 606 && end_unchanged >= tlendpos |
| 607 && Z - GPT >= tlendpos))) | |
| 608 { | |
| 609 if (tlbufpos > BEGV && FETCH_CHAR (tlbufpos - 1) != '\n' | |
| 610 && (tlbufpos == ZV | |
| 611 || FETCH_CHAR (tlbufpos) == '\n')) | |
| 612 /* Former continuation line has disappeared by becoming empty */ | |
| 613 goto cancel; | |
| 614 else if (XFASTINT (w->last_modified) < MODIFF | |
| 615 || MINI_WINDOW_P (w)) | |
| 616 { | |
| 617 cursor_vpos = -1; | |
| 618 overlay_arrow_seen = 0; | |
| 619 display_text_line (w, tlbufpos, this_line_vpos, this_line_start_hpos, | |
| 620 pos_tab_offset (w, tlbufpos)); | |
| 621 /* If line contains point, is not continued, | |
| 622 and ends at same distance from eob as before, we win */ | |
| 623 if (cursor_vpos >= 0 && this_line_bufpos | |
| 624 && this_line_endpos == tlendpos) | |
| 625 { | |
|
6619
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
626 int left = XFASTINT (w->left); |
|
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
627 int *charstart_next_line |
|
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
628 = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1]; |
|
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
629 int i; |
|
6622
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
630 int adjust; |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
631 |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
632 if (Z - tlendpos == ZV) |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
633 /* This line ends at end of (accessible part of) buffer. |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
634 There is no newline to count. */ |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
635 adjust = Z - tlendpos - charstart_next_line[left]; |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
636 else |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
637 /* This line ends in a newline. |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
638 Must take account of the newline and the rest of the |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
639 text that follows. */ |
|
1253ece9950b
(redisplay): In previous change, handle case where no newline follows.
Richard M. Stallman <rms@gnu.org>
parents:
6619
diff
changeset
|
640 adjust = Z - tlendpos + 1 - charstart_next_line[left]; |
|
6619
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
641 |
|
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
642 adjust_window_charstarts (w, this_line_vpos, adjust); |
|
b3631c88ec7e
(redisplay): Call adjust_window_charstarts
Richard M. Stallman <rms@gnu.org>
parents:
6612
diff
changeset
|
643 |
| 769 | 644 if (XFASTINT (w->width) != FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) |
| 277 | 645 preserve_other_columns (w); |
| 646 goto update; | |
| 647 } | |
| 648 else | |
| 649 goto cancel; | |
| 650 } | |
| 651 else if (point == XFASTINT (w->last_point)) | |
| 652 { | |
| 653 if (!must_finish) | |
| 654 { | |
| 655 do_pending_window_change (); | |
| 656 return; | |
| 657 } | |
| 658 goto update; | |
| 659 } | |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
660 /* If highlighting the region, we can't just move the cursor. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
661 else if (! (!NILP (Vtransient_mark_mode) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
662 && !NILP (current_buffer->mark_active)) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
663 && NILP (w->region_showing)) |
| 277 | 664 { |
| 665 pos = *compute_motion (tlbufpos, 0, | |
| 666 XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0, | |
| 667 point, 2, - (1 << (SHORTBITS - 1)), | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
668 window_internal_width (w) - 1, |
| 574 | 669 XINT (w->hscroll), |
| 670 pos_tab_offset (w, tlbufpos)); | |
| 277 | 671 if (pos.vpos < 1) |
| 672 { | |
| 769 | 673 FRAME_CURSOR_X (selected_frame) |
| 277 | 674 = XFASTINT (w->left) + max (pos.hpos, 0); |
| 769 | 675 FRAME_CURSOR_Y (selected_frame) = this_line_vpos; |
| 277 | 676 goto update; |
| 677 } | |
| 678 else | |
| 679 goto cancel; | |
| 680 } | |
| 681 cancel: | |
| 682 /* Text changed drastically or point moved off of line */ | |
| 769 | 683 cancel_line (this_line_vpos, selected_frame); |
| 277 | 684 } |
| 685 | |
| 686 this_line_bufpos = 0; | |
| 687 all_windows |= buffer_shared > 1; | |
| 688 | |
| 689 if (all_windows) | |
| 690 { | |
|
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
691 Lisp_Object tail, frame; |
| 277 | 692 |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
693 #ifdef HAVE_X_WINDOWS |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
694 /* Since we're doing a thorough redisplay, we might as well |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
695 recompute all our display faces. */ |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
696 clear_face_vector (); |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
697 #endif |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
698 |
| 277 | 699 /* Recompute # windows showing selected buffer. |
| 433 | 700 This will be incremented each time such a window is displayed. */ |
| 277 | 701 buffer_shared = 0; |
| 702 | |
|
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
703 FOR_EACH_FRAME (tail, frame) |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
704 { |
|
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
705 FRAME_PTR f = XFRAME (frame); |
|
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2189
diff
changeset
|
706 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
707 /* Mark all the scroll bars to be removed; we'll redeem the ones |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
708 we want when we redisplay their windows. */ |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
709 if (condemn_scroll_bars_hook) |
|
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
710 (*condemn_scroll_bars_hook) (f); |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
711 |
|
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
712 if (FRAME_VISIBLE_P (f)) |
|
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
713 redisplay_windows (FRAME_ROOT_WINDOW (f)); |
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
714 #ifdef HAVE_X_WINDOWS |
|
6371
fa4643560045
(redisplay): Don't consider minibuffer name for frame title.
Karl Heuer <kwzh@gnu.org>
parents:
6366
diff
changeset
|
715 else if (FRAME_ICONIFIED_P (f) |
|
fa4643560045
(redisplay): Don't consider minibuffer name for frame title.
Karl Heuer <kwzh@gnu.org>
parents:
6366
diff
changeset
|
716 && ! MINI_WINDOW_P (XWINDOW (f->selected_window))) |
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
717 x_consider_frame_title (frame); |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
718 #endif |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
719 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
720 /* Any scroll bars which redisplay_windows should have nuked |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
721 should now go away. */ |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
722 if (judge_scroll_bars_hook) |
|
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
723 (*judge_scroll_bars_hook) (f); |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
724 } |
| 277 | 725 } |
| 769 | 726 else if (FRAME_VISIBLE_P (selected_frame)) |
| 277 | 727 { |
| 728 redisplay_window (selected_window, 1); | |
| 769 | 729 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame)) |
| 277 | 730 preserve_other_columns (w); |
| 731 } | |
| 732 | |
| 733 update: | |
| 734 /* Prevent various kinds of signals during display update. | |
| 735 stdio is not robust about handling signals, | |
| 736 which can cause an apparent I/O error. */ | |
| 737 if (interrupt_input) | |
| 738 unrequest_sigio (); | |
| 739 stop_polling (); | |
| 740 | |
| 769 | 741 #ifdef MULTI_FRAME |
| 277 | 742 if (all_windows) |
| 743 { | |
| 744 Lisp_Object tail; | |
| 745 | |
| 746 pause = 0; | |
| 747 | |
| 769 | 748 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
| 277 | 749 { |
| 769 | 750 FRAME_PTR f; |
| 277 | 751 |
| 769 | 752 if (XTYPE (XCONS (tail)->car) != Lisp_Frame) |
| 277 | 753 continue; |
| 754 | |
| 769 | 755 f = XFRAME (XCONS (tail)->car); |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
756 if (FRAME_VISIBLE_P (f)) |
| 277 | 757 { |
| 769 | 758 pause |= update_frame (f, 0, 0); |
| 277 | 759 if (!pause) |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
760 { |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
761 mark_window_display_accurate (f->root_window, 1); |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
762 if (frame_up_to_date_hook != 0) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
763 (*frame_up_to_date_hook) (f); |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
764 } |
| 277 | 765 } |
| 766 } | |
| 767 } | |
| 768 else | |
| 769 | 769 #endif /* MULTI_FRAME */ |
| 368 | 770 { |
| 769 | 771 if (FRAME_VISIBLE_P (selected_frame)) |
| 772 pause = update_frame (selected_frame, 0, 0); | |
|
1656
a532c5a23984
* xdisp.c (redisplay): Call FRAME_SAMPLE_VISIBILITY to set the
Jim Blandy <jimb@redhat.com>
parents:
1600
diff
changeset
|
773 |
| 433 | 774 /* We may have called echo_area_display at the top of this |
| 769 | 775 function. If the echo area is on another frame, that may |
| 776 have put text on a frame other than the selected one, so the | |
| 777 above call to update_frame would not have caught it. Catch | |
| 433 | 778 it here. */ |
| 779 { | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
780 FRAME_PTR mini_frame |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
781 = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 433 | 782 |
| 769 | 783 if (mini_frame != selected_frame) |
| 784 pause |= update_frame (mini_frame, 0, 0); | |
| 433 | 785 } |
| 368 | 786 } |
| 277 | 787 |
| 769 | 788 /* If frame does not match, prevent doing single-line-update next time. |
| 277 | 789 Also, don't forget to check every line to update the arrow. */ |
| 790 if (pause) | |
| 791 { | |
| 792 this_line_bufpos = 0; | |
| 485 | 793 if (!NILP (last_arrow_position)) |
| 277 | 794 { |
| 795 last_arrow_position = Qt; | |
| 796 last_arrow_string = Qt; | |
| 797 } | |
| 769 | 798 /* If we pause after scrolling, some lines in current_frame |
| 277 | 799 may be null, so preserve_other_columns won't be able to |
| 800 preserve all the vertical-bar separators. So, avoid using it | |
| 801 in that case. */ | |
| 769 | 802 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame)) |
| 277 | 803 update_mode_lines = 1; |
| 804 } | |
| 805 | |
| 769 | 806 /* Now text on frame agrees with windows, so |
| 277 | 807 put info into the windows for partial redisplay to follow */ |
| 808 | |
| 809 if (!pause) | |
| 810 { | |
| 811 register struct buffer *b = XBUFFER (w->buffer); | |
| 812 | |
| 813 blank_end_of_window = 0; | |
| 814 clip_changed = 0; | |
| 815 unchanged_modified = BUF_MODIFF (b); | |
| 816 beg_unchanged = BUF_GPT (b) - BUF_BEG (b); | |
| 817 end_unchanged = BUF_Z (b) - BUF_GPT (b); | |
| 818 | |
| 819 XFASTINT (w->last_point) = BUF_PT (b); | |
| 769 | 820 XFASTINT (w->last_point_x) = FRAME_CURSOR_X (selected_frame); |
| 821 XFASTINT (w->last_point_y) = FRAME_CURSOR_Y (selected_frame); | |
| 277 | 822 |
| 823 if (all_windows) | |
|
1017
d42877206c0a
* xdisp.c (display_mode_line): Use x_implicitly_set_name here.
Jim Blandy <jimb@redhat.com>
parents:
973
diff
changeset
|
824 mark_window_display_accurate (FRAME_ROOT_WINDOW (selected_frame), 1); |
| 277 | 825 else |
| 826 { | |
| 827 w->update_mode_line = Qnil; | |
| 828 XFASTINT (w->last_modified) = BUF_MODIFF (b); | |
| 829 w->window_end_valid = Qt; | |
| 830 last_arrow_position = Voverlay_arrow_position; | |
| 831 last_arrow_string = Voverlay_arrow_string; | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
832 if (frame_up_to_date_hook != 0) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
833 (*frame_up_to_date_hook) (selected_frame); |
| 277 | 834 } |
| 835 update_mode_lines = 0; | |
| 836 windows_or_buffers_changed = 0; | |
| 837 } | |
| 838 | |
| 839 /* Start SIGIO interrupts coming again. | |
| 840 Having them off during the code above | |
| 841 makes it less likely one will discard output, | |
| 842 but not impossible, since there might be stuff | |
| 843 in the system buffer here. | |
| 844 But it is much hairier to try to do anything about that. */ | |
| 845 | |
| 846 if (interrupt_input) | |
| 847 request_sigio (); | |
| 848 start_polling (); | |
| 849 | |
| 769 | 850 /* Change frame size now if a change is pending. */ |
| 277 | 851 do_pending_window_change (); |
| 852 } | |
| 853 | |
| 854 /* Redisplay, but leave alone any recent echo area message | |
| 855 unless another message has been requested in its place. | |
| 856 | |
| 857 This is useful in situations where you need to redisplay but no | |
| 858 user action has occurred, making it inappropriate for the message | |
| 859 area to be cleared. See tracking_off and | |
| 860 wait_reading_process_input for examples of these situations. */ | |
| 861 | |
| 862 redisplay_preserve_echo_area () | |
| 863 { | |
| 864 if (echo_area_glyphs == 0 && previous_echo_glyphs != 0) | |
| 865 { | |
| 866 echo_area_glyphs = previous_echo_glyphs; | |
| 867 redisplay (); | |
| 868 echo_area_glyphs = 0; | |
| 869 } | |
| 870 else | |
| 871 redisplay (); | |
| 872 } | |
| 873 | |
| 874 void | |
| 875 mark_window_display_accurate (window, flag) | |
| 876 Lisp_Object window; | |
| 877 int flag; | |
| 878 { | |
| 879 register struct window *w; | |
| 880 | |
| 485 | 881 for (;!NILP (window); window = w->next) |
| 277 | 882 { |
|
1527
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
883 if (XTYPE (window) != Lisp_Window) abort (); |
| 277 | 884 w = XWINDOW (window); |
| 885 | |
| 485 | 886 if (!NILP (w->buffer)) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
887 { |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
888 XFASTINT (w->last_modified) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
889 = !flag ? 0 |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
890 : XBUFFER (w->buffer) == current_buffer |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
891 ? MODIFF : BUF_MODIFF (XBUFFER (w->buffer)); |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
892 |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
893 /* Record if we are showing a region, so can make sure to |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
894 update it fully at next redisplay. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
895 w->region_showing = (!NILP (Vtransient_mark_mode) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
896 && !NILP (XBUFFER (w->buffer)->mark_active) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
897 ? Fmarker_position (XBUFFER (w->buffer)->mark) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
898 : Qnil); |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
899 } |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
900 |
| 277 | 901 w->window_end_valid = Qt; |
| 902 w->update_mode_line = Qnil; | |
| 903 | |
| 485 | 904 if (!NILP (w->vchild)) |
| 277 | 905 mark_window_display_accurate (w->vchild, flag); |
| 485 | 906 if (!NILP (w->hchild)) |
| 277 | 907 mark_window_display_accurate (w->hchild, flag); |
| 908 } | |
| 909 | |
| 910 if (flag) | |
| 911 { | |
| 912 last_arrow_position = Voverlay_arrow_position; | |
| 913 last_arrow_string = Voverlay_arrow_string; | |
| 914 } | |
| 915 else | |
| 916 { | |
| 917 /* t is unequal to any useful value of Voverlay_arrow_... */ | |
| 918 last_arrow_position = Qt; | |
| 919 last_arrow_string = Qt; | |
| 920 } | |
| 921 } | |
| 922 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
923 /* Update the menu bar item lists for WINDOW |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
924 and its subwindows and siblings. |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
925 This has to be done before we start to fill in any display lines, |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
926 because it can call eval. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
927 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
928 static void |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
929 update_menu_bars (window) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
930 Lisp_Object window; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
931 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
932 for (; !NILP (window); window = XWINDOW (window)->next) |
|
6372
89fdd37c2397
(update_menu_bar): Delete unused second argument. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
6371
diff
changeset
|
933 update_menu_bar (window); |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
934 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
935 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
936 /* Update the menu bar item list for window WINDOW and its subwindows. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
937 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
938 static void |
|
6372
89fdd37c2397
(update_menu_bar): Delete unused second argument. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
6371
diff
changeset
|
939 update_menu_bar (window) |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
940 Lisp_Object window; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
941 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
942 register struct window *w = XWINDOW (window); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
943 struct buffer *old = current_buffer; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
944 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
945 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
946 /* If this is a combination window, do its children; that's all. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
947 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
948 if (!NILP (w->vchild)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
949 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
950 update_menu_bars (w->vchild); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
951 return; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
952 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
953 if (!NILP (w->hchild)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
954 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
955 update_menu_bars (w->hchild); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
956 return; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
957 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
958 if (NILP (w->buffer)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
959 abort (); |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
960 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
961 if (update_mode_lines) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
962 w->update_mode_line = Qt; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
963 |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
964 /* When we reach a frame's selected window, redo the frame's menu bar. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
965 if (!NILP (w->update_mode_line) |
|
5676
b5027523c90d
Wed Jan 26 12:23:12 1994 Frederic Pierresteguy (fp@mole.gnu.ai.mit.edu)
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5658
diff
changeset
|
966 #ifdef USE_X_TOOLKIT |
|
b5027523c90d
Wed Jan 26 12:23:12 1994 Frederic Pierresteguy (fp@mole.gnu.ai.mit.edu)
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5658
diff
changeset
|
967 && FRAME_EXTERNAL_MENU_BAR (f) |
|
b5027523c90d
Wed Jan 26 12:23:12 1994 Frederic Pierresteguy (fp@mole.gnu.ai.mit.edu)
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5658
diff
changeset
|
968 #else |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
969 && 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>
parents:
5658
diff
changeset
|
970 #endif |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
971 && EQ (FRAME_SELECTED_WINDOW (f), window)) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
972 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
973 /* If the user has switched buffers or windows, we need to |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
974 recompute to reflect the new bindings. But we'll |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
975 recompute when update_mode_lines is set too; that means |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
976 that people can use force-mode-line-update to request |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
977 that the menu bar be recomputed. The adverse effect on |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
978 the rest of the redisplay algorithm is about the same as |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
979 windows_or_buffers_changed anyway. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
980 if (windows_or_buffers_changed |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
981 || update_mode_lines |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
982 || (XFASTINT (w->last_modified) < MODIFF |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
983 && (XFASTINT (w->last_modified) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
984 <= XBUFFER (w->buffer)->save_modified))) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
985 { |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
986 struct buffer *prev = current_buffer; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
987 current_buffer = XBUFFER (w->buffer); |
|
6134
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
988 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
989 current_buffer = prev; |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
990 #ifdef USE_X_TOOLKIT |
|
6630
cd036c4e1dfd
(update_menu_bar): Pass 0 to set_frame_menubar.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6628
diff
changeset
|
991 set_frame_menubar (f, 0); |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
992 #endif /* USE_X_TOOLKIT */ |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
993 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
994 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
995 } |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
996 |
| 277 | 997 int do_id = 1; |
| 998 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
999 /* Redisplay WINDOW and its subwindows and siblings. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
1000 |
| 277 | 1001 static void |
| 1002 redisplay_windows (window) | |
| 1003 Lisp_Object window; | |
| 1004 { | |
| 485 | 1005 for (; !NILP (window); window = XWINDOW (window)->next) |
| 277 | 1006 redisplay_window (window, 0); |
| 1007 } | |
| 1008 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
1009 /* Redisplay window WINDOW and its subwindows. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
1010 |
| 277 | 1011 static void |
| 1012 redisplay_window (window, just_this_one) | |
| 1013 Lisp_Object window; | |
| 1014 int just_this_one; | |
| 1015 { | |
| 1016 register struct window *w = XWINDOW (window); | |
|
1718
f80c1f73f5b9
* xdisp.c: #include "termhooks.h".
Jim Blandy <jimb@redhat.com>
parents:
1656
diff
changeset
|
1017 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
| 277 | 1018 int height; |
| 1019 register int lpoint = point; | |
| 1020 struct buffer *old = current_buffer; | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1021 register int width = window_internal_width (w) - 1; |
| 277 | 1022 register int startp; |
| 1023 register int hscroll = XINT (w->hscroll); | |
| 1024 struct position pos; | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1025 int opoint = point; |
| 277 | 1026 int tem; |
| 1027 int window_needs_modeline; | |
| 1028 | |
| 769 | 1029 if (FRAME_HEIGHT (f) == 0) abort (); /* Some bug zeros some core */ |
| 277 | 1030 |
| 1031 /* If this is a combination window, do its children; that's all. */ | |
| 1032 | |
| 485 | 1033 if (!NILP (w->vchild)) |
| 277 | 1034 { |
| 1035 redisplay_windows (w->vchild); | |
| 1036 return; | |
| 1037 } | |
| 485 | 1038 if (!NILP (w->hchild)) |
| 277 | 1039 { |
| 1040 redisplay_windows (w->hchild); | |
| 1041 return; | |
| 1042 } | |
| 485 | 1043 if (NILP (w->buffer)) |
| 277 | 1044 abort (); |
| 433 | 1045 |
| 1046 height = window_internal_height (w); | |
| 1047 | |
| 1048 if (MINI_WINDOW_P (w)) | |
| 1049 { | |
| 1050 if (w == XWINDOW (minibuf_window)) | |
| 1051 { | |
| 1052 if (echo_area_glyphs) | |
| 1053 /* We've already displayed the echo area glyphs, if any. */ | |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1054 goto finish_scroll_bars; |
| 433 | 1055 } |
| 1056 else | |
| 1057 { | |
| 1058 /* This is a minibuffer, but it's not the currently active one, so | |
| 1059 clear it. */ | |
| 769 | 1060 int vpos = XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top); |
| 433 | 1061 int i; |
| 1062 | |
| 1063 for (i = 0; i < height; i++) | |
| 1064 { | |
| 769 | 1065 get_display_line (f, vpos + i, 0); |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1066 display_string (w, vpos + i, "", 0, 0, 0, 1, 0, width); |
| 433 | 1067 } |
| 1068 | |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1069 goto finish_scroll_bars; |
| 433 | 1070 } |
| 1071 } | |
| 277 | 1072 |
| 1073 if (update_mode_lines) | |
| 1074 w->update_mode_line = Qt; | |
| 1075 | |
| 1076 /* Otherwise set up data on this window; select its buffer and point value */ | |
| 1077 | |
| 1078 current_buffer = XBUFFER (w->buffer); | |
| 1079 opoint = point; | |
| 1080 | |
| 1081 /* Count number of windows showing the selected buffer. */ | |
| 1082 | |
| 1083 if (!just_this_one | |
| 1084 && current_buffer == XBUFFER (XWINDOW (selected_window)->buffer)) | |
| 1085 buffer_shared++; | |
| 1086 | |
| 1087 /* POINT refers normally to the selected window. | |
| 1088 For any other window, set up appropriate value. */ | |
| 1089 | |
| 1090 if (!EQ (window, selected_window)) | |
| 1091 { | |
| 1092 SET_PT (marker_position (w->pointm)); | |
| 1093 if (point < BEGV) | |
| 1094 { | |
| 485 | 1095 SET_PT (BEGV); |
| 277 | 1096 Fset_marker (w->pointm, make_number (point), Qnil); |
| 1097 } | |
| 1098 else if (point > (ZV - 1)) | |
| 1099 { | |
| 485 | 1100 SET_PT (ZV); |
| 277 | 1101 Fset_marker (w->pointm, make_number (point), Qnil); |
| 1102 } | |
| 1103 } | |
| 1104 | |
| 1105 /* If window-start is screwed up, choose a new one. */ | |
| 1106 if (XMARKER (w->start)->buffer != current_buffer) | |
| 1107 goto recenter; | |
| 1108 | |
| 1109 startp = marker_position (w->start); | |
| 1110 | |
| 433 | 1111 /* Handle case where place to start displaying has been specified, |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1112 unless the specified location is outside the accessible range. */ |
| 485 | 1113 if (!NILP (w->force_start)) |
| 277 | 1114 { |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1115 /* Forget any recorded base line for line number display. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1116 w->base_line_number = Qnil; |
| 277 | 1117 w->update_mode_line = Qt; |
| 1118 w->force_start = Qnil; | |
| 1119 XFASTINT (w->last_modified) = 0; | |
| 433 | 1120 if (startp < BEGV) startp = BEGV; |
| 1121 if (startp > ZV) startp = ZV; | |
| 277 | 1122 try_window (window, startp); |
| 1123 if (cursor_vpos < 0) | |
| 1124 { | |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1125 /* ??? What should happen here if highlighting a region? */ |
| 277 | 1126 /* If point does not appear, move point so it does appear */ |
| 1127 pos = *compute_motion (startp, 0, | |
| 1128 ((EQ (window, minibuf_window) && startp == 1) | |
| 1129 ? minibuf_prompt_width : 0) | |
| 1130 + | |
| 1131 (hscroll ? 1 - hscroll : 0), | |
| 1132 ZV, height / 2, | |
| 1133 - (1 << (SHORTBITS - 1)), | |
| 1134 width, hscroll, pos_tab_offset (w, startp)); | |
| 1135 SET_PT (pos.bufpos); | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
1136 if (w != XWINDOW (selected_window)) |
| 277 | 1137 Fset_marker (w->pointm, make_number (point), Qnil); |
| 1138 else | |
| 1139 { | |
|
5340
fcd6e0da3380
(redisplay_window): Before altering lpoint,
Richard M. Stallman <rms@gnu.org>
parents:
5230
diff
changeset
|
1140 if (current_buffer == old) |
|
fcd6e0da3380
(redisplay_window): Before altering lpoint,
Richard M. Stallman <rms@gnu.org>
parents:
5230
diff
changeset
|
1141 lpoint = point; |
| 769 | 1142 FRAME_CURSOR_X (f) = max (0, pos.hpos) + XFASTINT (w->left); |
| 1143 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top); | |
| 277 | 1144 } |
| 1145 } | |
| 1146 goto done; | |
| 1147 } | |
| 1148 | |
| 1149 /* Handle case where text has not changed, only point, | |
| 769 | 1150 and it has not moved off the frame */ |
| 277 | 1151 |
| 1152 /* This code is not used for minibuffer for the sake of | |
| 1153 the case of redisplaying to replace an echo area message; | |
| 1154 since in that case the minibuffer contents per se are usually unchanged. | |
| 1155 This code is of no real use in the minibuffer since | |
| 1156 the handling of this_line_bufpos, etc., | |
| 1157 in redisplay handles the same cases. */ | |
| 1158 | |
| 1159 if (XFASTINT (w->last_modified) >= MODIFF | |
| 1160 && point >= startp && !clip_changed | |
| 769 | 1161 && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f)) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1162 /* Can't use this case if highlighting a region. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1163 && !(!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1164 && NILP (w->region_showing) |
| 277 | 1165 && !EQ (window, minibuf_window)) |
| 1166 { | |
| 1167 pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0), | |
| 1168 point, height + 1, 10000, width, hscroll, | |
| 1169 pos_tab_offset (w, startp)); | |
| 1170 | |
| 1171 if (pos.vpos < height) | |
| 1172 { | |
| 769 | 1173 /* Ok, point is still on frame */ |
| 1174 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) | |
| 277 | 1175 { |
| 1176 /* These variables are supposed to be origin 1 */ | |
| 769 | 1177 FRAME_CURSOR_X (f) = max (0, pos.hpos) + XFASTINT (w->left); |
| 1178 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top); | |
| 277 | 1179 } |
| 1180 /* This doesn't do the trick, because if a window to the right of | |
| 1181 this one must be redisplayed, this does nothing because there | |
| 769 | 1182 is nothing in DesiredFrame yet, and then the other window is |
| 277 | 1183 redisplayed, making likes that are empty in this window's columns. |
| 769 | 1184 if (XFASTINT (w->width) != FRAME_WIDTH (f)) |
| 277 | 1185 preserve_my_columns (w); |
| 1186 */ | |
| 1187 goto done; | |
| 1188 } | |
| 1189 /* Don't bother trying redisplay with same start; | |
| 1190 we already know it will lose */ | |
| 1191 } | |
| 1192 /* If current starting point was originally the beginning of a line | |
| 1193 but no longer is, find a new starting point. */ | |
| 485 | 1194 else if (!NILP (w->start_at_line_beg) |
| 277 | 1195 && !(startp == BEGV |
| 1196 || FETCH_CHAR (startp - 1) == '\n')) | |
| 1197 { | |
| 1198 goto recenter; | |
| 1199 } | |
| 1200 else if (just_this_one && !MINI_WINDOW_P (w) | |
| 1201 && point >= startp | |
| 1202 && XFASTINT (w->last_modified) | |
|
3648
9838d64cc5ae
* xdisp.c (redisplay_window): Don't call try_window_id if the
Jim Blandy <jimb@redhat.com>
parents:
3586
diff
changeset
|
1203 /* or else vmotion on first line won't work. */ |
|
9838d64cc5ae
* xdisp.c (redisplay_window): Don't call try_window_id if the
Jim Blandy <jimb@redhat.com>
parents:
3586
diff
changeset
|
1204 && ! NILP (w->start_at_line_beg) |
| 277 | 1205 && ! EQ (w->window_end_valid, Qnil) |
| 1206 && do_id && !clip_changed | |
| 1207 && !blank_end_of_window | |
| 769 | 1208 && XFASTINT (w->width) == FRAME_WIDTH (f) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1209 /* Can't use this case if highlighting a region. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1210 && !(!NILP (Vtransient_mark_mode) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1211 && !NILP (current_buffer->mark_active)) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1212 && NILP (w->region_showing) |
| 277 | 1213 && EQ (last_arrow_position, Voverlay_arrow_position) |
| 1214 && EQ (last_arrow_string, Voverlay_arrow_string) | |
| 769 | 1215 && (tem = try_window_id (FRAME_SELECTED_WINDOW (f))) |
| 277 | 1216 && tem != -2) |
| 1217 { | |
| 1218 /* tem > 0 means success. tem == -1 means choose new start. | |
| 1219 tem == -2 means try again with same start, | |
| 1220 and nothing but whitespace follows the changed stuff. | |
| 1221 tem == 0 means try again with same start. */ | |
| 1222 if (tem > 0) | |
| 1223 goto done; | |
| 1224 } | |
| 1225 else if (startp >= BEGV && startp <= ZV | |
| 1226 /* Avoid starting display at end of buffer! */ | |
| 433 | 1227 && (startp < ZV || startp == BEGV |
| 277 | 1228 || (XFASTINT (w->last_modified) >= MODIFF))) |
| 1229 { | |
| 1230 /* Try to redisplay starting at same place as before */ | |
| 769 | 1231 /* If point has not moved off frame, accept the results */ |
| 277 | 1232 try_window (window, startp); |
| 1233 if (cursor_vpos >= 0) | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1234 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1235 if (!just_this_one || clip_changed || beg_unchanged < startp) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1236 /* Forget any recorded base line for line number display. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1237 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1238 goto done; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1239 } |
| 277 | 1240 else |
| 1241 cancel_my_columns (w); | |
| 1242 } | |
| 1243 | |
| 1244 XFASTINT (w->last_modified) = 0; | |
| 1245 w->update_mode_line = Qt; | |
| 1246 | |
| 1247 /* Try to scroll by specified few lines */ | |
| 1248 | |
| 1249 if (scroll_step && !clip_changed) | |
| 1250 { | |
| 1251 if (point > startp) | |
| 1252 { | |
| 1253 pos = *vmotion (Z - XFASTINT (w->window_end_pos), | |
| 1254 scroll_step, width, hscroll, window); | |
| 1255 if (pos.vpos >= height) | |
| 1256 goto scroll_fail; | |
| 1257 } | |
| 1258 | |
| 1259 pos = *vmotion (startp, point < startp ? - scroll_step : scroll_step, | |
| 1260 width, hscroll, window); | |
| 1261 | |
| 1262 if (point >= pos.bufpos) | |
| 1263 { | |
| 1264 try_window (window, pos.bufpos); | |
| 1265 if (cursor_vpos >= 0) | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1266 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1267 if (!just_this_one || clip_changed || beg_unchanged < startp) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1268 /* Forget any recorded base line for line number display. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1269 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1270 goto done; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1271 } |
| 277 | 1272 else |
| 1273 cancel_my_columns (w); | |
| 1274 } | |
| 1275 scroll_fail: ; | |
| 1276 } | |
| 1277 | |
| 1278 /* Finally, just choose place to start which centers point */ | |
| 1279 | |
| 1280 recenter: | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1281 /* Forget any previously recorded base line for line number display. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1282 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1283 |
|
6342
c9e33093c488
(redisplay_window): Avoid dividing negative numbers, since the rounding effect
Karl Heuer <kwzh@gnu.org>
parents:
6308
diff
changeset
|
1284 pos = *vmotion (point, - (height / 2), width, hscroll, window); |
| 277 | 1285 try_window (window, pos.bufpos); |
| 1286 | |
| 1287 startp = marker_position (w->start); | |
| 1288 w->start_at_line_beg = | |
| 1289 (startp == BEGV || FETCH_CHAR (startp - 1) == '\n') ? Qt : Qnil; | |
| 1290 | |
| 1291 done: | |
| 485 | 1292 if ((!NILP (w->update_mode_line) |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1293 /* If window not full width, must redo its mode line |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1294 if the window to its side is being redone */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1295 || (!just_this_one && width < FRAME_WIDTH (f) - 1) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1296 || INTEGERP (w->base_line_pos)) |
| 277 | 1297 && height != XFASTINT (w->height)) |
| 1298 display_mode_line (w); | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1299 if (! line_number_displayed |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1300 && ! BUFFERP (w->base_line_pos)) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1301 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1302 w->base_line_pos = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1303 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
1304 } |
| 277 | 1305 |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1306 /* When we reach a frame's selected window, redo the frame's menu bar. */ |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1307 if (!NILP (w->update_mode_line) |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
1308 #ifdef USE_X_TOOLKIT |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
1309 && FRAME_EXTERNAL_MENU_BAR (f) |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
1310 #else |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1311 && FRAME_MENU_BAR_LINES (f) > 0 |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
1312 #endif |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1313 && EQ (FRAME_SELECTED_WINDOW (f), window)) |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1314 display_menu_bar (w); |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
1315 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1316 finish_scroll_bars: |
|
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1317 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1318 { |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1319 int start, end, whole; |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1320 |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1321 /* Calculate the start and end positions for the current window. |
|
2874
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1322 At some point, it would be nice to choose between scrollbars |
|
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1323 which reflect the whole buffer size, with special markers |
|
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1324 indicating narrowing, and scrollbars which reflect only the |
|
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1325 visible region. |
|
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1326 |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1327 Note that minibuffers sometimes aren't displaying any text. */ |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1328 if (! MINI_WINDOW_P (w) |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1329 || (w == XWINDOW (minibuf_window) && ! echo_area_glyphs)) |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1330 { |
|
2929
f3c44426bed2
Fix the fix to scrollbar computaaFix the fix to the fix for scrollbar computation.
Jim Blandy <jimb@redhat.com>
parents:
2904
diff
changeset
|
1331 whole = ZV - BEGV; |
|
2904
d9f7768b0d89
* xdisp.c (redisplay_window): Compute the scrollbar start and end
Jim Blandy <jimb@redhat.com>
parents:
2884
diff
changeset
|
1332 start = startp - BEGV; |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1333 /* I don't think this is guaranteed to be right. For the |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1334 moment, we'll pretend it is. */ |
|
3880
ef6a4d39634b
* xdisp.c (redisplay_window): Remember to compute end relative to
Jim Blandy <jimb@redhat.com>
parents:
3788
diff
changeset
|
1335 end = (Z - XINT (w->window_end_pos)) - BEGV; |
|
2874
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1336 |
|
80805283464a
* xdisp.c (redisplay_window): Make the scrollbar reflect the
Jim Blandy <jimb@redhat.com>
parents:
2848
diff
changeset
|
1337 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>
parents:
2904
diff
changeset
|
1338 if (whole < (end - start)) whole = end - start; |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1339 } |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1340 else |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1341 start = end = whole = 0; |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1342 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1343 /* Indicate what this scroll bar ought to be displaying now. */ |
|
3788
41a297faf4ac
* xdisp.c (redisplay_window): No need to subtract one from start
Jim Blandy <jimb@redhat.com>
parents:
3750
diff
changeset
|
1344 (*set_vertical_scroll_bar_hook) (w, end - start, whole, start); |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1345 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1346 /* Note that we actually used the scroll bar attached to this window, |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1347 so it shouldn't be deleted at the end of redisplay. */ |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
1348 (*redeem_scroll_bar_hook) (w); |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1349 } |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1350 |
| 277 | 1351 SET_PT (opoint); |
| 1352 current_buffer = old; | |
| 1353 SET_PT (lpoint); | |
| 1354 } | |
| 1355 | |
| 1356 /* Do full redisplay on one window, starting at position `pos'. */ | |
| 1357 | |
| 1358 static void | |
| 1359 try_window (window, pos) | |
| 1360 Lisp_Object window; | |
| 1361 register int pos; | |
| 1362 { | |
| 1363 register struct window *w = XWINDOW (window); | |
| 1364 register int height = window_internal_height (w); | |
| 1365 register int vpos = XFASTINT (w->top); | |
| 1366 register int last_text_vpos = vpos; | |
| 1367 int tab_offset = pos_tab_offset (w, pos); | |
| 769 | 1368 FRAME_PTR f = XFRAME (w->frame); |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1369 int width = window_internal_width (w) - 1; |
| 277 | 1370 struct position val; |
| 1371 | |
| 1372 Fset_marker (w->start, make_number (pos), Qnil); | |
| 1373 cursor_vpos = -1; | |
| 1374 overlay_arrow_seen = 0; | |
| 1375 val.hpos = XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0; | |
| 1376 | |
| 1377 while (--height >= 0) | |
| 1378 { | |
| 1379 val = *display_text_line (w, pos, vpos, val.hpos, tab_offset); | |
| 1380 tab_offset += width; | |
| 1381 if (val.vpos) tab_offset = 0; | |
| 1382 vpos++; | |
| 1383 if (pos != val.bufpos) | |
| 1384 last_text_vpos | |
| 1385 /* Next line, unless prev line ended in end of buffer with no cr */ | |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
1386 = vpos - (val.vpos && (FETCH_CHAR (val.bufpos - 1) != '\n' |
|
6065
ab1aef4b0e07
(try_window): Add #ifdef USE_TEXT_PROPERTIES around call to Fget_text_property.
Karl Heuer <kwzh@gnu.org>
parents:
5942
diff
changeset
|
1387 #ifdef USE_TEXT_PROPERTIES |
|
6066
4ff0c5c05867
(try_window, display_text_line): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6065
diff
changeset
|
1388 || ! NILP (Fget_char_property (val.bufpos-1, |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
1389 Qinvisible, |
|
6066
4ff0c5c05867
(try_window, display_text_line): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6065
diff
changeset
|
1390 window)) |
|
6065
ab1aef4b0e07
(try_window): Add #ifdef USE_TEXT_PROPERTIES around call to Fget_text_property.
Karl Heuer <kwzh@gnu.org>
parents:
5942
diff
changeset
|
1391 #endif |
|
ab1aef4b0e07
(try_window): Add #ifdef USE_TEXT_PROPERTIES around call to Fget_text_property.
Karl Heuer <kwzh@gnu.org>
parents:
5942
diff
changeset
|
1392 )); |
| 277 | 1393 pos = val.bufpos; |
| 1394 } | |
| 1395 | |
| 1396 /* If last line is continued in middle of character, | |
| 769 | 1397 include the split character in the text considered on the frame */ |
| 277 | 1398 if (val.hpos < (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0)) |
| 1399 pos++; | |
| 1400 | |
| 769 | 1401 /* If bottom just moved off end of frame, change mode line percentage. */ |
| 277 | 1402 if (XFASTINT (w->window_end_pos) == 0 |
| 1403 && Z != pos) | |
| 1404 w->update_mode_line = Qt; | |
| 1405 | |
| 769 | 1406 /* Say where last char on frame will be, once redisplay is finished. */ |
| 277 | 1407 XFASTINT (w->window_end_pos) = Z - pos; |
| 1408 XFASTINT (w->window_end_vpos) = last_text_vpos - XFASTINT (w->top); | |
| 1409 /* But that is not valid info until redisplay finishes. */ | |
| 1410 w->window_end_valid = Qnil; | |
| 1411 } | |
| 1412 | |
| 1413 /* Try to redisplay when buffer is modified locally, | |
| 1414 computing insert/delete line to preserve text outside | |
| 1415 the bounds of the changes. | |
| 1416 Return 1 if successful, 0 if if cannot tell what to do, | |
| 1417 or -1 to tell caller to find a new window start, | |
| 1418 or -2 to tell caller to do normal redisplay with same window start. */ | |
| 1419 | |
| 1420 static int | |
| 1421 try_window_id (window) | |
| 1422 Lisp_Object window; | |
| 1423 { | |
| 1424 int pos; | |
| 1425 register struct window *w = XWINDOW (window); | |
| 1426 register int height = window_internal_height (w); | |
| 769 | 1427 FRAME_PTR f = XFRAME (w->frame); |
| 277 | 1428 int top = XFASTINT (w->top); |
| 1429 int start = marker_position (w->start); | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1430 int width = window_internal_width (w) - 1; |
| 277 | 1431 int hscroll = XINT (w->hscroll); |
| 1432 int lmargin = hscroll > 0 ? 1 - hscroll : 0; | |
| 1433 register int vpos; | |
| 1434 register int i, tem; | |
| 1435 int last_text_vpos = 0; | |
| 1436 int stop_vpos; | |
|
5942
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1437 int selective |
|
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1438 = XTYPE (current_buffer->selective_display) == Lisp_Int |
|
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1439 ? XINT (current_buffer->selective_display) |
|
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1440 : !NILP (current_buffer->selective_display) ? -1 : 0; |
| 277 | 1441 |
| 1442 struct position val, bp, ep, xp, pp; | |
| 1443 int scroll_amount = 0; | |
| 1444 int delta; | |
| 1445 int tab_offset, epto; | |
| 1446 | |
| 1447 if (GPT - BEG < beg_unchanged) | |
| 1448 beg_unchanged = GPT - BEG; | |
| 1449 if (Z - GPT < end_unchanged) | |
| 1450 end_unchanged = Z - GPT; | |
| 1451 | |
|
5739
0709eb474647
(try_window_id): Don't pass value beyond ZV to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
5676
diff
changeset
|
1452 if (beg_unchanged + BEG < start) |
| 277 | 1453 return 0; /* Give up if changes go above top of window */ |
| 1454 | |
| 1455 /* Find position before which nothing is changed. */ | |
| 1456 bp = *compute_motion (start, 0, lmargin, | |
|
5739
0709eb474647
(try_window_id): Don't pass value beyond ZV to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
5676
diff
changeset
|
1457 min (ZV, beg_unchanged + BEG), height + 1, 0, |
|
0709eb474647
(try_window_id): Don't pass value beyond ZV to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
5676
diff
changeset
|
1458 width, hscroll, pos_tab_offset (w, start)); |
| 277 | 1459 if (bp.vpos >= height) |
| 368 | 1460 { |
| 1461 if (point < bp.bufpos && !bp.contin) | |
| 1462 { | |
| 769 | 1463 /* All changes are below the frame, and point is on the frame. |
| 1464 We don't need to change the frame at all. | |
| 368 | 1465 But we need to update window_end_pos to account for |
| 1466 any change in buffer size. */ | |
| 371 | 1467 bp = *compute_motion (start, 0, lmargin, |
| 1468 Z, height, 0, | |
| 1469 width, hscroll, pos_tab_offset (w, start)); | |
| 368 | 1470 XFASTINT (w->window_end_vpos) = height; |
| 1471 XFASTINT (w->window_end_pos) = Z - bp.bufpos; | |
| 1472 return 1; | |
| 1473 } | |
| 1474 return 0; | |
| 1475 } | |
| 277 | 1476 |
| 1477 vpos = bp.vpos; | |
| 1478 | |
| 769 | 1479 /* Find beginning of that frame line. Must display from there. */ |
| 277 | 1480 bp = *vmotion (bp.bufpos, 0, width, hscroll, window); |
| 1481 | |
| 1482 pos = bp.bufpos; | |
| 1483 val.hpos = lmargin; | |
| 1484 if (pos < start) | |
| 1485 return -1; | |
| 1486 | |
| 1487 /* If about to start displaying at the beginning of a continuation line, | |
| 769 | 1488 really start with previous frame line, in case it was not |
| 277 | 1489 continued when last redisplayed */ |
| 528 | 1490 if ((bp.contin && bp.bufpos - 1 == beg_unchanged && vpos > 0) |
| 1491 || | |
| 1492 /* Likewise if we have to worry about selective display. */ | |
|
5942
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1493 (selective > 0 && bp.bufpos - 1 == beg_unchanged && vpos > 0)) |
| 277 | 1494 { |
| 1495 bp = *vmotion (bp.bufpos, -1, width, hscroll, window); | |
| 1496 --vpos; | |
| 1497 pos = bp.bufpos; | |
| 1498 } | |
| 1499 | |
| 1500 if (bp.contin && bp.hpos != lmargin) | |
| 1501 { | |
| 1502 val.hpos = bp.prevhpos - width + lmargin; | |
| 1503 pos--; | |
| 1504 } | |
| 1505 | |
| 1506 bp.vpos = vpos; | |
| 1507 | |
| 1508 /* Find first visible newline after which no more is changed. */ | |
| 1509 tem = find_next_newline (Z - max (end_unchanged, Z - ZV), 1); | |
|
5942
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1510 if (selective > 0) |
|
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
1511 while (tem < ZV - 1 && (indented_beyond_p (tem, selective))) |
| 277 | 1512 tem = find_next_newline (tem, 1); |
| 1513 | |
| 1514 /* Compute the cursor position after that newline. */ | |
| 1515 ep = *compute_motion (pos, vpos, val.hpos, tem, | |
| 1516 height, - (1 << (SHORTBITS - 1)), | |
| 1517 width, hscroll, pos_tab_offset (w, bp.bufpos)); | |
| 1518 | |
| 769 | 1519 /* If changes reach past the text available on the frame, |
| 1520 just display rest of frame. */ | |
| 277 | 1521 if (ep.bufpos > Z - XFASTINT (w->window_end_pos)) |
| 1522 stop_vpos = height; | |
| 1523 else | |
| 1524 stop_vpos = ep.vpos; | |
| 1525 | |
| 1526 /* If no newline before ep, the line ep is on includes some changes | |
| 1527 that must be displayed. Make sure we don't stop before it. */ | |
| 1528 /* Also, if changes reach all the way until ep.bufpos, | |
| 1529 it is possible that something was deleted after the | |
| 1530 newline before it, so the following line must be redrawn. */ | |
| 1531 if (stop_vpos == ep.vpos | |
| 1532 && (ep.bufpos == BEGV | |
| 1533 || FETCH_CHAR (ep.bufpos - 1) != '\n' | |
| 1534 || ep.bufpos == Z - end_unchanged)) | |
| 1535 stop_vpos = ep.vpos + 1; | |
| 1536 | |
| 1537 cursor_vpos = -1; | |
| 1538 overlay_arrow_seen = 0; | |
| 1539 | |
| 1540 /* If changes do not reach to bottom of window, | |
| 1541 figure out how much to scroll the rest of the window */ | |
| 1542 if (stop_vpos < height) | |
| 1543 { | |
| 1544 /* Now determine how far up or down the rest of the window has moved */ | |
| 1545 epto = pos_tab_offset (w, ep.bufpos); | |
| 1546 xp = *compute_motion (ep.bufpos, ep.vpos, ep.hpos, | |
| 1547 Z - XFASTINT (w->window_end_pos), | |
| 1548 10000, 0, width, hscroll, epto); | |
| 1549 scroll_amount = xp.vpos - XFASTINT (w->window_end_vpos); | |
| 1550 | |
| 769 | 1551 /* Is everything on frame below the changes whitespace? |
| 277 | 1552 If so, no scrolling is really necessary. */ |
| 1553 for (i = ep.bufpos; i < xp.bufpos; i++) | |
| 1554 { | |
| 1555 tem = FETCH_CHAR (i); | |
| 1556 if (tem != ' ' && tem != '\n' && tem != '\t') | |
| 1557 break; | |
| 1558 } | |
| 1559 if (i == xp.bufpos) | |
| 1560 return -2; | |
| 1561 | |
| 1562 XFASTINT (w->window_end_vpos) += scroll_amount; | |
| 1563 | |
| 769 | 1564 /* Before doing any scrolling, verify that point will be on frame. */ |
| 277 | 1565 if (point > ep.bufpos && !(point <= xp.bufpos && xp.bufpos < height)) |
| 1566 { | |
| 1567 if (point <= xp.bufpos) | |
| 1568 { | |
| 1569 pp = *compute_motion (ep.bufpos, ep.vpos, ep.hpos, | |
| 1570 point, height, - (1 << (SHORTBITS - 1)), | |
| 1571 width, hscroll, epto); | |
| 1572 } | |
| 1573 else | |
| 1574 { | |
| 1575 pp = *compute_motion (xp.bufpos, xp.vpos, xp.hpos, | |
| 1576 point, height, - (1 << (SHORTBITS - 1)), | |
| 1577 width, hscroll, pos_tab_offset (w, xp.bufpos)); | |
| 1578 } | |
| 1579 if (pp.bufpos < point || pp.vpos == height) | |
| 1580 return 0; | |
| 1581 cursor_vpos = pp.vpos + top; | |
| 1582 cursor_hpos = pp.hpos + XFASTINT (w->left); | |
| 1583 } | |
| 1584 | |
| 1585 if (stop_vpos - scroll_amount >= height | |
| 1586 || ep.bufpos == xp.bufpos) | |
| 1587 { | |
| 1588 if (scroll_amount < 0) | |
| 1589 stop_vpos -= scroll_amount; | |
| 1590 scroll_amount = 0; | |
| 1591 /* In this path, we have altered window_end_vpos | |
| 1592 and not left it negative. | |
| 1593 We must make sure that, in case display is preempted | |
| 769 | 1594 before the frame changes to reflect what we do here, |
| 277 | 1595 further updates will not come to try_window_id |
| 769 | 1596 and assume the frame and window_end_vpos match. */ |
| 277 | 1597 blank_end_of_window = 1; |
| 1598 } | |
| 1599 else if (!scroll_amount) | |
| 1600 {} | |
| 1601 else if (bp.bufpos == Z - end_unchanged) | |
| 1602 { | |
| 1603 /* If reprinting everything is nearly as fast as scrolling, | |
| 1604 don't bother scrolling. Can happen if lines are short. */ | |
| 769 | 1605 if (scroll_cost (f, bp.vpos + top - scroll_amount, |
| 277 | 1606 top + height - max (0, scroll_amount), |
| 1607 scroll_amount) | |
| 1608 > xp.bufpos - bp.bufpos - 20) | |
| 1609 /* Return "try normal display with same window-start." | |
| 1610 Too bad we can't prevent further scroll-thinking. */ | |
| 1611 return -2; | |
| 1612 /* If pure deletion, scroll up as many lines as possible. | |
| 1613 In common case of killing a line, this can save the | |
| 1614 following line from being overwritten by scrolling | |
| 1615 and therefore having to be redrawn. */ | |
| 769 | 1616 tem = scroll_frame_lines (f, bp.vpos + top - scroll_amount, |
|
6628
c359dfd21b00
(try_window_id): Pass new arg to scroll_frame_lines.
Richard M. Stallman <rms@gnu.org>
parents:
6622
diff
changeset
|
1617 top + height - max (0, scroll_amount), |
|
c359dfd21b00
(try_window_id): Pass new arg to scroll_frame_lines.
Richard M. Stallman <rms@gnu.org>
parents:
6622
diff
changeset
|
1618 scroll_amount, bp.bufpos); |
| 277 | 1619 if (!tem) stop_vpos = height; |
| 1620 } | |
| 1621 else if (scroll_amount) | |
| 1622 { | |
| 1623 /* If reprinting everything is nearly as fast as scrolling, | |
| 1624 don't bother scrolling. Can happen if lines are short. */ | |
| 1625 /* Note that if scroll_amount > 0, xp.bufpos - bp.bufpos is an | |
| 1626 overestimate of cost of reprinting, since xp.bufpos | |
| 1627 would end up below the bottom of the window. */ | |
| 769 | 1628 if (scroll_cost (f, ep.vpos + top - scroll_amount, |
| 277 | 1629 top + height - max (0, scroll_amount), |
| 1630 scroll_amount) | |
| 1631 > xp.bufpos - ep.bufpos - 20) | |
| 1632 /* Return "try normal display with same window-start." | |
| 1633 Too bad we can't prevent further scroll-thinking. */ | |
| 1634 return -2; | |
| 769 | 1635 tem = scroll_frame_lines (f, ep.vpos + top - scroll_amount, |
| 277 | 1636 top + height - max (0, scroll_amount), |
|
6628
c359dfd21b00
(try_window_id): Pass new arg to scroll_frame_lines.
Richard M. Stallman <rms@gnu.org>
parents:
6622
diff
changeset
|
1637 scroll_amount, ep.bufpos); |
| 277 | 1638 if (!tem) stop_vpos = height; |
| 1639 } | |
| 1640 } | |
| 1641 | |
| 1642 /* In any case, do not display past bottom of window */ | |
| 1643 if (stop_vpos >= height) | |
| 1644 { | |
| 1645 stop_vpos = height; | |
| 1646 scroll_amount = 0; | |
| 1647 } | |
| 1648 | |
| 1649 /* Handle case where pos is before w->start -- | |
| 1650 can happen if part of line had been clipped and is not clipped now */ | |
| 1651 if (vpos == 0 && pos < marker_position (w->start)) | |
| 1652 Fset_marker (w->start, make_number (pos), Qnil); | |
| 1653 | |
| 1654 /* Redisplay the lines where the text was changed */ | |
| 1655 last_text_vpos = vpos; | |
| 1656 tab_offset = pos_tab_offset (w, pos); | |
| 1657 /* If we are starting display in mid-character, correct tab_offset | |
| 1658 to account for passing the line that that character really starts in. */ | |
| 1659 if (val.hpos < lmargin) | |
| 1660 tab_offset += width; | |
| 1661 while (vpos < stop_vpos) | |
| 1662 { | |
| 1663 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset); | |
| 1664 tab_offset += width; | |
| 1665 if (val.vpos) tab_offset = 0; | |
| 1666 if (pos != val.bufpos) | |
| 1667 last_text_vpos | |
| 1668 /* Next line, unless prev line ended in end of buffer with no cr */ | |
| 1669 = vpos - (val.vpos && FETCH_CHAR (val.bufpos - 1) != '\n'); | |
| 1670 pos = val.bufpos; | |
| 1671 } | |
| 1672 | |
| 1673 /* There are two cases: | |
| 1674 1) we have displayed down to the bottom of the window | |
| 1675 2) we have scrolled lines below stop_vpos by scroll_amount */ | |
| 1676 | |
| 1677 if (vpos == height) | |
| 1678 { | |
| 1679 /* If last line is continued in middle of character, | |
| 769 | 1680 include the split character in the text considered on the frame */ |
| 277 | 1681 if (val.hpos < lmargin) |
| 1682 val.bufpos++; | |
| 1683 XFASTINT (w->window_end_vpos) = last_text_vpos; | |
| 1684 XFASTINT (w->window_end_pos) = Z - val.bufpos; | |
| 1685 } | |
| 1686 | |
| 1687 /* If scrolling made blank lines at window bottom, | |
| 1688 redisplay to fill those lines */ | |
| 1689 if (scroll_amount < 0) | |
| 1690 { | |
| 1691 /* Don't consider these lines for general-purpose scrolling. | |
| 1692 That will save time in the scrolling computation. */ | |
| 769 | 1693 FRAME_SCROLL_BOTTOM_VPOS (f) = xp.vpos; |
| 277 | 1694 vpos = xp.vpos; |
| 1695 pos = xp.bufpos; | |
| 1696 val.hpos = lmargin; | |
| 1697 if (pos == ZV) | |
| 1698 vpos = height + scroll_amount; | |
| 1699 else if (xp.contin && xp.hpos != lmargin) | |
| 1700 { | |
| 1701 val.hpos = xp.prevhpos - width + lmargin; | |
| 1702 pos--; | |
| 1703 } | |
| 1704 | |
| 1705 blank_end_of_window = 1; | |
| 1706 tab_offset = pos_tab_offset (w, pos); | |
| 1707 /* If we are starting display in mid-character, correct tab_offset | |
| 1708 to account for passing the line that that character starts in. */ | |
| 1709 if (val.hpos < lmargin) | |
| 1710 tab_offset += width; | |
| 1711 | |
| 1712 while (vpos < height) | |
| 1713 { | |
| 1714 val = *display_text_line (w, pos, top + vpos++, val.hpos, tab_offset); | |
| 1715 tab_offset += width; | |
| 1716 if (val.vpos) tab_offset = 0; | |
| 1717 pos = val.bufpos; | |
| 1718 } | |
| 1719 | |
| 1720 /* Here is a case where display_text_line sets cursor_vpos wrong. | |
| 1721 Make it be fixed up, below. */ | |
| 1722 if (xp.bufpos == ZV | |
| 1723 && xp.bufpos == point) | |
| 1724 cursor_vpos = -1; | |
| 1725 } | |
| 1726 | |
| 769 | 1727 /* If bottom just moved off end of frame, change mode line percentage. */ |
| 277 | 1728 if (XFASTINT (w->window_end_pos) == 0 |
| 1729 && Z != val.bufpos) | |
| 1730 w->update_mode_line = Qt; | |
| 1731 | |
| 1732 /* Attempt to adjust end-of-text positions to new bottom line */ | |
| 1733 if (scroll_amount) | |
| 1734 { | |
| 1735 delta = height - xp.vpos; | |
| 1736 if (delta < 0 | |
| 1737 || (delta > 0 && xp.bufpos <= ZV) | |
| 1738 || (delta == 0 && xp.hpos)) | |
| 1739 { | |
| 1740 val = *vmotion (Z - XFASTINT (w->window_end_pos), | |
| 1741 delta, width, hscroll, window); | |
| 1742 XFASTINT (w->window_end_pos) = Z - val.bufpos; | |
| 1743 XFASTINT (w->window_end_vpos) += val.vpos; | |
| 1744 } | |
| 1745 } | |
| 1746 | |
| 1747 w->window_end_valid = Qnil; | |
| 1748 | |
| 1749 /* If point was not in a line that was displayed, find it */ | |
| 1750 if (cursor_vpos < 0) | |
| 1751 { | |
| 1752 val = *compute_motion (start, 0, lmargin, point, 10000, 10000, | |
| 1753 width, hscroll, pos_tab_offset (w, start)); | |
| 769 | 1754 /* Admit failure if point is off frame now */ |
| 277 | 1755 if (val.vpos >= height) |
| 1756 { | |
| 1757 for (vpos = 0; vpos < height; vpos++) | |
| 769 | 1758 cancel_line (vpos + top, f); |
| 277 | 1759 return 0; |
| 1760 } | |
| 1761 cursor_vpos = val.vpos + top; | |
| 1762 cursor_hpos = val.hpos + XFASTINT (w->left); | |
| 1763 } | |
| 1764 | |
| 769 | 1765 FRAME_CURSOR_X (f) = max (0, cursor_hpos); |
| 1766 FRAME_CURSOR_Y (f) = cursor_vpos; | |
| 277 | 1767 |
| 1768 if (debug_end_pos) | |
| 1769 { | |
| 1770 val = *compute_motion (start, 0, lmargin, ZV, | |
| 1771 height, - (1 << (SHORTBITS - 1)), | |
| 1772 width, hscroll, pos_tab_offset (w, start)); | |
| 1773 if (val.vpos != XFASTINT (w->window_end_vpos)) | |
| 1774 abort (); | |
| 1775 if (XFASTINT (w->window_end_pos) | |
| 1776 != Z - val.bufpos) | |
| 1777 abort (); | |
| 1778 } | |
| 1779 | |
| 1780 return 1; | |
| 1781 } | |
| 1782 | |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1783 /* Mark a section of BUF as modified, but only for the sake of redisplay. |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1784 This is useful for recording changes to overlays. |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1785 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1786 We increment the buffer's modification timestamp and set the |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1787 redisplay caches (windows_or_buffers_changed, beg_unchanged, etc) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1788 as if the region of text between START and END had been modified; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1789 the redisplay code will check this against the windows' timestamps, |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1790 and redraw the appropriate area of the buffer. |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1791 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1792 However, if the buffer is unmodified, we bump the last-save |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1793 timestamp as well, so that incrementing the timestamp doesn't fool |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1794 Emacs into thinking that the buffer's text has been modified. |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1795 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1796 Tweaking the timestamps shouldn't hurt the first-modification |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1797 timestamps recorded in the undo records; those values aren't |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1798 written until just before a real text modification is made, so they |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1799 will never catch the timestamp value just before this function gets |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1800 called. */ |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1801 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1802 void |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1803 redisplay_region (buf, start, end) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1804 struct buffer *buf; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1805 int start, end; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1806 { |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1807 if (start == end) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1808 return; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1809 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1810 if (start > end) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1811 { |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1812 int temp = start; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1813 start = end; end = temp; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1814 } |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1815 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1816 if (buf != current_buffer) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1817 windows_or_buffers_changed = 1; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1818 else |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1819 { |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1820 if (unchanged_modified == MODIFF) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1821 { |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1822 beg_unchanged = start - BEG; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1823 end_unchanged = Z - end; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1824 } |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1825 else |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1826 { |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1827 if (Z - end < end_unchanged) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1828 end_unchanged = Z - end; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1829 if (start - BEG < beg_unchanged) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1830 beg_unchanged = start - BEG; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1831 } |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1832 } |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1833 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1834 /* Increment the buffer's time stamp, but also increment the save |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1835 and autosave timestamps, so as not to screw up that timekeeping. */ |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1836 if (BUF_MODIFF (buf) == buf->save_modified) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1837 buf->save_modified++; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1838 if (BUF_MODIFF (buf) == buf->auto_save_modified) |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1839 buf->auto_save_modified++; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1840 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1841 BUF_MODIFF (buf) ++; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1842 } |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1843 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1844 |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1845 /* Copy LEN glyphs starting address FROM to the rope TO. |
| 301 | 1846 But don't actually copy the parts that would come in before S. |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1847 Value is TO, advanced past the copied data. |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1848 F is the frame we are displaying in. */ |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1849 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1850 static GLYPH * |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1851 copy_part_of_rope (f, to, s, from, len, face) |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1852 FRAME_PTR f; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1853 register GLYPH *to; /* Copy to here. */ |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
1854 register GLYPH *s; /* Starting point. */ |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
1855 Lisp_Object *from; /* Data to copy. */ |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
1856 int len; |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
1857 int face; /* Face to apply to glyphs which don't specify one. */ |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
1858 { |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1859 int n = len; |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1860 register Lisp_Object *fp = from; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1861 /* These cache the results of the last call to compute_glyph_face. */ |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1862 int last_code = -1; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1863 int last_merged = 0; |
| 277 | 1864 |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1865 #ifdef HAVE_X_WINDOWS |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1866 if (! FRAME_TERMCAP_P (f)) |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1867 while (n--) |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1868 { |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1869 int glyph = XFASTINT (*fp); |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1870 int facecode; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1871 |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1872 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>
parents:
6372
diff
changeset
|
1873 /* 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>
parents:
6372
diff
changeset
|
1874 facecode = face; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1875 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>
parents:
6372
diff
changeset
|
1876 /* 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>
parents:
6372
diff
changeset
|
1877 facecode = last_merged; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1878 else |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1879 { |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1880 /* 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>
parents:
6372
diff
changeset
|
1881 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>
parents:
6372
diff
changeset
|
1882 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>
parents:
6372
diff
changeset
|
1883 } |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1884 |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1885 if (to >= s) |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1886 *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>
parents:
6372
diff
changeset
|
1887 ++to; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1888 ++fp; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1889 } |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1890 else |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1891 #endif |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1892 while (n--) |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1893 { |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1894 if (to >= s) *to = XFASTINT (*fp); |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1895 ++to; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1896 ++fp; |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1897 } |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1898 return to; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1899 } |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1900 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1901 /* Correct a glyph by replacing its specified user-level face code |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1902 with a displayable computed face code. */ |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1903 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1904 static GLYPH |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1905 fix_glyph (f, glyph, current_face) |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1906 FRAME_PTR f; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1907 GLYPH glyph; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1908 int current_face; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1909 { |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1910 #ifdef HAVE_X_WINDOWS |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1911 if (! FRAME_TERMCAP_P (f) && FAST_GLYPH_FACE (glyph) != 0) |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1912 return FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1913 compute_glyph_face (f, FAST_GLYPH_FACE (glyph), |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1914 current_face)); |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1915 #endif |
|
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
1916 return glyph; |
| 277 | 1917 } |
| 1918 | |
| 1919 /* Display one line of window w, starting at position START in W's buffer. | |
| 1920 Display starting at horizontal position HPOS, which is normally zero | |
| 1921 or negative. A negative value causes output up to hpos = 0 to be discarded. | |
| 1922 This is done for negative hscroll, or when this is a continuation line | |
| 1923 and the continuation occurred in the middle of a multi-column character. | |
| 1924 | |
| 1925 TABOFFSET is an offset for ostensible hpos, used in tab stop calculations. | |
| 1926 | |
| 769 | 1927 Display on position VPOS on the frame. (origin 0). |
| 277 | 1928 |
| 1929 Returns a STRUCT POSITION giving character to start next line with | |
| 1930 and where to display it, including a zero or negative hpos. | |
| 1931 The vpos field is not really a vpos; it is 1 unless the line is continued */ | |
| 1932 | |
| 1933 struct position val_display_text_line; | |
| 1934 | |
| 1935 static struct position * | |
| 1936 display_text_line (w, start, vpos, hpos, taboffset) | |
| 1937 struct window *w; | |
| 1938 int start; | |
| 1939 int vpos; | |
| 1940 int hpos; | |
| 1941 int taboffset; | |
| 1942 { | |
| 1943 register int pos = start; | |
| 1944 register int c; | |
| 1945 register GLYPH *p1; | |
| 1946 int end; | |
| 1947 register int pause; | |
| 1948 register unsigned char *p; | |
| 1949 GLYPH *endp; | |
| 1950 register GLYPH *startp; | |
|
3586
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
1951 register GLYPH *p1prev = 0; |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
1952 register GLYPH *p1start; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
1953 int *charstart; |
| 769 | 1954 FRAME_PTR f = XFRAME (w->frame); |
| 277 | 1955 int tab_width = XINT (current_buffer->tab_width); |
| 485 | 1956 int ctl_arrow = !NILP (current_buffer->ctl_arrow); |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
1957 int width = window_internal_width (w) - 1; |
| 277 | 1958 struct position val; |
| 1959 int lastpos; | |
| 1960 int invis; | |
| 1961 int hscroll = XINT (w->hscroll); | |
| 1962 int truncate = hscroll | |
| 1963 || (truncate_partial_width_windows | |
| 769 | 1964 && XFASTINT (w->width) < FRAME_WIDTH (f)) |
| 485 | 1965 || !NILP (current_buffer->truncate_lines); |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1966 |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1967 /* 1 if we should highlight the region. */ |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1968 int highlight_region |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1969 = !NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active); |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1970 int region_beg, region_end; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
1971 |
| 277 | 1972 int selective |
| 1973 = XTYPE (current_buffer->selective_display) == Lisp_Int | |
| 1974 ? XINT (current_buffer->selective_display) | |
| 485 | 1975 : !NILP (current_buffer->selective_display) ? -1 : 0; |
| 769 | 1976 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f); |
| 277 | 1977 register struct Lisp_Vector *dp = window_display_table (w); |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1978 |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1979 Lisp_Object default_invis_vector[3]; |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1980 /* Nonzero means display something where there are invisible lines. |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1981 The precise value is the number of glyphs to display. */ |
| 277 | 1982 int selective_rlen |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
1983 = (selective && dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1984 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1985 : selective && !NILP (current_buffer->selective_display_ellipses) |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1986 ? 3 : 0); |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1987 /* This is the sequence of Lisp objects to display |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1988 when there are invisible lines. */ |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1989 Lisp_Object *invis_vector_contents |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1990 = (dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1991 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1992 : default_invis_vector); |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
1993 |
| 277 | 1994 GLYPH truncator = (dp == 0 || XTYPE (DISP_TRUNC_GLYPH (dp)) != Lisp_Int |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1995 ? '$' : XINT (DISP_TRUNC_GLYPH (dp))); |
| 277 | 1996 GLYPH continuer = (dp == 0 || XTYPE (DISP_CONTINUE_GLYPH (dp)) != Lisp_Int |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
1997 ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp))); |
| 277 | 1998 |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
1999 /* The next buffer location at which the face should change, due |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2000 to overlays or text property changes. */ |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2001 int next_face_change; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2002 |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2003 #ifdef USE_TEXT_PROPERTIES |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2004 /* The next location where the `invisible' property changes */ |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2005 int next_invisible; |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2006 #endif |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2007 |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2008 /* The face we're currently using. */ |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2009 int current_face = 0; |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2010 int i; |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2011 |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
2012 XFASTINT (default_invis_vector[2]) = '.'; |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
2013 default_invis_vector[0] = default_invis_vector[1] = default_invis_vector[2]; |
|
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
2014 |
| 277 | 2015 hpos += XFASTINT (w->left); |
| 769 | 2016 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>
parents:
2303
diff
changeset
|
2017 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
| 277 | 2018 |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2019 /* Show where to highlight the region. */ |
|
2965
5314fdcd87bc
(display_text_line): Highlight in any frame's sel window.
Richard M. Stallman <rms@gnu.org>
parents:
2929
diff
changeset
|
2020 if (highlight_region && XMARKER (current_buffer->mark)->buffer != 0 |
|
3265
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
2021 /* Maybe highlight only in selected window. */ |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
2022 && (highlight_nonselected_windows |
|
3266
1173bc4814da
(display_text_line): Really check for just the selected window.
Richard M. Stallman <rms@gnu.org>
parents:
3265
diff
changeset
|
2023 || w == XWINDOW (selected_window))) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2024 { |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2025 region_beg = marker_position (current_buffer->mark); |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2026 if (PT < region_beg) |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2027 { |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2028 region_end = region_beg; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2029 region_beg = PT; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2030 } |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2031 else |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2032 region_end = PT; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2033 w->region_showing = Qt; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2034 } |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2035 else |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2036 region_beg = region_end = -1; |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2037 |
| 277 | 2038 if (MINI_WINDOW_P (w) && start == 1 |
| 2039 && vpos == XFASTINT (w->top)) | |
| 2040 { | |
| 2041 if (minibuf_prompt) | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
2042 hpos = display_string (w, vpos, minibuf_prompt, -1, hpos, |
| 277 | 2043 (!truncate ? continuer : truncator), |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2044 1, -1, -1); |
| 277 | 2045 minibuf_prompt_width = hpos; |
| 2046 } | |
| 2047 | |
| 2048 desired_glyphs->bufp[vpos] = pos; | |
| 2049 p1 = desired_glyphs->glyphs[vpos] + hpos; | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2050 p1start = p1; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2051 charstart = desired_glyphs->charstarts[vpos] + hpos; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2052 /* In case we don't ever write anything into it... */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2053 *charstart = -1; |
| 277 | 2054 end = ZV; |
| 2055 startp = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); | |
| 2056 endp = startp + width; | |
| 2057 | |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2058 /* Arrange the overlays nicely for our purposes. Usually, we call |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2059 display_text_line on only one line at a time, in which case this |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2060 can't really hurt too much, or we call it on lines which appear |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2061 one after another in the buffer, in which case all calls to |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2062 recenter_overlay_lists but the first will be pretty cheap. */ |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2063 recenter_overlay_lists (current_buffer, pos); |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2064 |
| 277 | 2065 /* Loop generating characters. |
| 2066 Stop at end of buffer, before newline, | |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2067 if reach or pass continuation column, |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2068 or at face change. */ |
| 277 | 2069 pause = pos; |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2070 next_face_change = pos; |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2071 #ifdef USE_TEXT_PROPERTIES |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2072 next_invisible = pos; |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2073 #endif |
| 277 | 2074 while (p1 < endp) |
| 2075 { | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2076 /* Record which glyph starts a character, |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2077 and the character position of that character. */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2078 charstart[p1 - p1start] = pos; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2079 |
| 277 | 2080 p1prev = p1; |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2081 if (pos >= pause) |
| 277 | 2082 { |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2083 /* Did we hit the end of the visible region of the buffer? |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2084 Stop here. */ |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2085 if (pos >= end) |
| 277 | 2086 break; |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2087 |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2088 /* Did we reach point? Record the cursor location. */ |
| 277 | 2089 if (pos == point && cursor_vpos < 0) |
| 2090 { | |
| 2091 cursor_vpos = vpos; | |
| 2092 cursor_hpos = p1 - startp; | |
| 2093 } | |
| 2094 | |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2095 #ifdef USE_TEXT_PROPERTIES |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2096 /* if the `invisible' property is set to t, we can skip to |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2097 the next property change */ |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2098 while (pos == next_invisible && pos < end) |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2099 { |
|
6066
4ff0c5c05867
(try_window, display_text_line): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6065
diff
changeset
|
2100 Lisp_Object position, limit, endpos, prop, ww; |
|
5082
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2101 XFASTINT (position) = pos; |
|
6066
4ff0c5c05867
(try_window, display_text_line): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6065
diff
changeset
|
2102 XSET (ww, Lisp_Window, w); |
|
4ff0c5c05867
(try_window, display_text_line): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6065
diff
changeset
|
2103 prop = Fget_char_property (position, Qinvisible, ww); |
|
5082
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2104 /* This is just an estimate to give reasonable |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2105 performance; nothing should go wrong if it is too small. */ |
|
6091
b634e16673ab
(display_text_line): Allow for invisible overlays in next_invisible lookahead.
Karl Heuer <kwzh@gnu.org>
parents:
6066
diff
changeset
|
2106 limit = Fnext_overlay_change (position); |
|
b634e16673ab
(display_text_line): Allow for invisible overlays in next_invisible lookahead.
Karl Heuer <kwzh@gnu.org>
parents:
6066
diff
changeset
|
2107 if (XFASTINT (limit) > pos + 50) |
|
b634e16673ab
(display_text_line): Allow for invisible overlays in next_invisible lookahead.
Karl Heuer <kwzh@gnu.org>
parents:
6066
diff
changeset
|
2108 XFASTINT (limit) = pos + 50; |
|
b634e16673ab
(display_text_line): Allow for invisible overlays in next_invisible lookahead.
Karl Heuer <kwzh@gnu.org>
parents:
6066
diff
changeset
|
2109 endpos = Fnext_single_property_change (position, Qinvisible, |
|
5082
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2110 Fcurrent_buffer (), limit); |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2111 if (INTEGERP (endpos)) |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2112 next_invisible = XINT (endpos); |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2113 else |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2114 next_invisible = end; |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2115 if (! NILP (prop)) |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2116 { |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2117 if (pos < point && next_invisible >= point) |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2118 { |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2119 cursor_vpos = vpos; |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2120 cursor_hpos = p1 - startp; |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2121 } |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2122 pos = next_invisible; |
|
47a76678bf4d
(display_text_line): Pass new arg to compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
2123 } |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2124 } |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2125 if (pos >= end) |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2126 break; |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2127 #endif |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2128 |
|
2742
7800e6a86421
* xdisp.c (display_text_line): Make face-handling code conditional
Jim Blandy <jimb@redhat.com>
parents:
2729
diff
changeset
|
2129 #ifdef HAVE_X_WINDOWS |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2130 /* Did we hit a face change? Figure out what face we should |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2131 use now. We also hit this the first time through the |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2132 loop, to see what face we should start with. */ |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2133 if (pos >= next_face_change && FRAME_X_P (f)) |
|
2848
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2134 current_face = compute_char_face (f, w, pos, |
|
3bcbd1795280
(mark_window_display_accurate): Set region_showing fields.
Richard M. Stallman <rms@gnu.org>
parents:
2766
diff
changeset
|
2135 region_beg, region_end, |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2136 &next_face_change, pos + 50, 0); |
|
2742
7800e6a86421
* xdisp.c (display_text_line): Make face-handling code conditional
Jim Blandy <jimb@redhat.com>
parents:
2729
diff
changeset
|
2137 #endif |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2138 |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2139 pause = end; |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2140 |
|
4386
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2141 #ifdef USE_TEXT_PROPERTIES |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2142 if (pos < next_invisible && next_invisible < pause) |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2143 pause = next_invisible; |
|
abd79e187610
(try_window): Handle invisible newline at end of buffer.
Richard M. Stallman <rms@gnu.org>
parents:
3937
diff
changeset
|
2144 #endif |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2145 if (pos < next_face_change && next_face_change < pause) |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2146 pause = next_face_change; |
|
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2147 |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2148 /* Wouldn't you hate to read the next line to someone over |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2149 the phone? */ |
| 277 | 2150 if (pos < point && point < pause) |
| 2151 pause = point; | |
| 2152 if (pos < GPT && GPT < pause) | |
| 2153 pause = GPT; | |
| 2154 | |
| 2155 p = &FETCH_CHAR (pos); | |
| 2156 } | |
| 2157 c = *p++; | |
| 2158 if (c >= 040 && c < 0177 | |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
2159 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector)) |
| 277 | 2160 { |
| 2161 if (p1 >= startp) | |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2162 *p1 = MAKE_GLYPH (f, c, current_face); |
| 277 | 2163 p1++; |
| 2164 } | |
| 2165 else if (c == '\n') | |
| 2166 { | |
| 2167 invis = 0; | |
| 2168 while (pos < end | |
| 2169 && selective > 0 | |
|
5942
c51e1ff87656
(try_window_id, display_text_line): Treat blank lines specially in
Karl Heuer <kwzh@gnu.org>
parents:
5936
diff
changeset
|
2170 && indented_beyond_p (pos + 1, selective)) |
| 277 | 2171 { |
| 2172 invis = 1; | |
| 2173 pos = find_next_newline (pos + 1, 1); | |
| 2174 if (FETCH_CHAR (pos - 1) == '\n') | |
| 2175 pos--; | |
| 2176 } | |
| 2177 if (invis && selective_rlen > 0 && p1 >= startp) | |
| 2178 { | |
| 2179 p1 += selective_rlen; | |
| 2180 if (p1 - startp > width) | |
| 2181 p1 = endp; | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2182 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2183 (p1 - p1prev), current_face); |
| 277 | 2184 } |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2185 #ifdef HAVE_X_WINDOWS |
|
2884
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2186 /* Draw the face of the newline character as extending all the |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2187 way to the end of the frame line. */ |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2188 if (current_face) |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2189 while (p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2190 *p1++ = FAST_MAKE_GLYPH (' ', current_face); |
|
2884
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2191 #endif |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
2192 break; |
| 277 | 2193 } |
| 2194 else if (c == '\t') | |
| 2195 { | |
| 2196 do | |
| 2197 { | |
| 2198 if (p1 >= startp && p1 < endp) | |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2199 *p1 = MAKE_GLYPH (f, ' ', current_face); |
| 277 | 2200 p1++; |
| 2201 } | |
| 2202 while ((p1 - startp + taboffset + hscroll - (hscroll > 0)) | |
| 2203 % tab_width); | |
| 2204 } | |
| 368 | 2205 else if (c == Ctl ('M') && selective == -1) |
| 277 | 2206 { |
| 2207 pos = find_next_newline (pos, 1); | |
| 2208 if (FETCH_CHAR (pos - 1) == '\n') | |
| 2209 pos--; | |
| 2210 if (selective_rlen > 0) | |
| 2211 { | |
| 2212 p1 += selective_rlen; | |
| 2213 if (p1 - startp > width) | |
| 2214 p1 = endp; | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2215 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, |
|
2766
aa7b6f6aa20a
* xdisp.c (copy_rope, copy_part_of_rope): Add face argument.
Jim Blandy <jimb@redhat.com>
parents:
2754
diff
changeset
|
2216 (p1 - p1prev), current_face); |
| 277 | 2217 } |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2218 #ifdef HAVE_X_WINDOWS |
|
2884
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2219 /* Draw the face of the newline character as extending all the |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2220 way to the end of the frame line. */ |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2221 if (current_face) |
|
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2222 while (p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2223 *p1++ = FAST_MAKE_GLYPH (' ', current_face); |
|
2884
e52ea063421a
* xdisp.c (display_text_line): If the newline (or C-m, in
Jim Blandy <jimb@redhat.com>
parents:
2874
diff
changeset
|
2224 #endif |
|
2754
af06c054b48f
(display_text_line): Use break; to exit loop at eol.
Richard M. Stallman <rms@gnu.org>
parents:
2742
diff
changeset
|
2225 break; |
| 277 | 2226 } |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
2227 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) |
| 277 | 2228 { |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2229 p1 = copy_part_of_rope (f, p1, startp, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2230 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2231 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2232 current_face); |
| 277 | 2233 } |
| 2234 else if (c < 0200 && ctl_arrow) | |
| 2235 { | |
| 2236 if (p1 >= startp) | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2237 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2238 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2239 current_face); |
| 277 | 2240 p1++; |
| 368 | 2241 if (p1 >= startp && p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2242 *p1 = MAKE_GLYPH (f, c ^ 0100, current_face); |
| 277 | 2243 p1++; |
| 2244 } | |
| 2245 else | |
| 2246 { | |
| 2247 if (p1 >= startp) | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2248 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2249 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2250 current_face); |
| 277 | 2251 p1++; |
| 368 | 2252 if (p1 >= startp && p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2253 *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face); |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2254 p1++; |
|
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2255 if (p1 >= startp && p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2256 *p1 = MAKE_GLYPH (f, (7 & (c >> 3)) + '0', current_face); |
| 277 | 2257 p1++; |
| 368 | 2258 if (p1 >= startp && p1 < endp) |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2259 *p1 = MAKE_GLYPH (f, (7 & c) + '0', current_face); |
| 277 | 2260 p1++; |
| 2261 } | |
|
2729
76afd3322533
Arrange to tell redisplay about changes in overlays.
Jim Blandy <jimb@redhat.com>
parents:
2526
diff
changeset
|
2262 |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2263 /* For all the glyphs occupied by this character, except for the |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2264 first, store -1 in charstarts. */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2265 if (p1 != p1prev) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2266 { |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2267 int *p2x = &charstart[p1prev - p1start] + 1; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2268 int *p2 = &charstart[p1 - p1start]; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2269 while (p2x != p2) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2270 *p2x++ = -1; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2271 } |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2272 else |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2273 /* If this character took up no space, |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2274 erase all mention of it from charstart. */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2275 charstart[p1 - p1start] = 0; |
| 277 | 2276 pos++; |
| 2277 } | |
| 2278 | |
| 2279 val.hpos = - XINT (w->hscroll); | |
| 2280 if (val.hpos) | |
| 2281 val.hpos++; | |
| 2282 | |
| 2283 val.vpos = 1; | |
| 2284 | |
| 2285 lastpos = pos; | |
| 2286 | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2287 /* Store 0 in this charstart line for the positions where |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2288 there is no character. But do leave what was recorded |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2289 for the character that ended the line. */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2290 for (i = p1 - p1start + 1; i < endp - p1start; i++) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2291 charstart[i] = 0; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
2292 |
| 277 | 2293 /* Handle continuation in middle of a character */ |
| 2294 /* by backing up over it */ | |
| 2295 if (p1 > endp) | |
| 2296 { | |
|
3586
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2297 /* Don't back up if we never actually displayed any text. |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2298 This occurs when the minibuffer prompt takes up the whole line. */ |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2299 if (p1prev) |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2300 { |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2301 /* Start the next line with that same character */ |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2302 pos--; |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2303 /* but at negative hpos, to skip the columns output on this line. */ |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2304 val.hpos += p1prev - endp; |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2305 } |
|
7d077274d4bb
* xdisp.c (display_text_line): Handle case where line ends in a
Jim Blandy <jimb@redhat.com>
parents:
3516
diff
changeset
|
2306 |
| 277 | 2307 /* Keep in this line everything up to the continuation column. */ |
| 2308 p1 = endp; | |
| 2309 } | |
| 2310 | |
| 2311 /* Finish deciding which character to start the next line on, | |
| 2312 and what hpos to start it at. | |
| 2313 Also set `lastpos' to the last position which counts as "on this line" | |
| 2314 for cursor-positioning. */ | |
| 2315 | |
| 2316 if (pos < ZV) | |
| 2317 { | |
| 2318 if (FETCH_CHAR (pos) == '\n') | |
|
6568
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2319 { |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2320 /* If stopped due to a newline, start next line after it */ |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2321 pos++; |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2322 /* Check again for hidden lines, in case the newline occurred exactly |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2323 at the right margin. */ |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2324 while (pos < ZV && selective > 0 |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2325 && indented_beyond_p (pos, selective)) |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2326 pos = find_next_newline (pos, 1); |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2327 } |
| 277 | 2328 else |
| 2329 /* Stopped due to right margin of window */ | |
| 2330 { | |
| 2331 if (truncate) | |
| 2332 { | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2333 *p1++ = fix_glyph (f, truncator, 0); |
| 277 | 2334 /* Truncating => start next line after next newline, |
| 2335 and point is on this line if it is before the newline, | |
| 2336 and skip none of first char of next line */ | |
|
6568
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2337 do |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2338 pos = find_next_newline (pos, 1); |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2339 while (pos < ZV && selective > 0 |
|
c87ae1f14148
(display_text_line): Handle selective display at window edge.
Karl Heuer <kwzh@gnu.org>
parents:
6518
diff
changeset
|
2340 && indented_beyond_p (pos, selective)); |
| 277 | 2341 val.hpos = XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0; |
| 2342 | |
| 2343 lastpos = pos - (FETCH_CHAR (pos - 1) == '\n'); | |
| 2344 } | |
| 2345 else | |
| 2346 { | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2347 *p1++ = fix_glyph (f, continuer, 0); |
| 277 | 2348 val.vpos = 0; |
| 2349 lastpos--; | |
| 2350 } | |
| 2351 } | |
| 2352 } | |
| 2353 | |
| 2354 /* If point is at eol or in invisible text at eol, | |
| 769 | 2355 record its frame location now. */ |
| 277 | 2356 |
| 2357 if (start <= point && point <= lastpos && cursor_vpos < 0) | |
| 2358 { | |
| 2359 cursor_vpos = vpos; | |
| 2360 cursor_hpos = p1 - startp; | |
| 2361 } | |
| 2362 | |
| 2363 if (cursor_vpos == vpos) | |
| 2364 { | |
| 2365 if (cursor_hpos < 0) cursor_hpos = 0; | |
| 2366 if (cursor_hpos > width) cursor_hpos = width; | |
| 2367 cursor_hpos += XFASTINT (w->left); | |
| 769 | 2368 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) |
| 277 | 2369 { |
| 769 | 2370 FRAME_CURSOR_Y (f) = cursor_vpos; |
| 2371 FRAME_CURSOR_X (f) = cursor_hpos; | |
| 277 | 2372 |
| 2373 if (w == XWINDOW (selected_window)) | |
| 2374 { | |
| 2375 /* Line is not continued and did not start | |
| 2376 in middle of character */ | |
| 2377 if ((hpos - XFASTINT (w->left) | |
| 2378 == (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0)) | |
| 2379 && val.vpos) | |
| 2380 { | |
| 2381 this_line_bufpos = start; | |
| 2382 this_line_buffer = current_buffer; | |
| 2383 this_line_vpos = cursor_vpos; | |
| 2384 this_line_start_hpos = hpos; | |
| 2385 this_line_endpos = Z - lastpos; | |
| 2386 } | |
| 2387 else | |
| 2388 this_line_bufpos = 0; | |
| 2389 } | |
| 2390 } | |
| 2391 } | |
| 2392 | |
| 2393 /* If hscroll and line not empty, insert truncation-at-left marker */ | |
| 2394 if (hscroll && lastpos != start) | |
| 2395 { | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2396 *startp = fix_glyph (f, truncator, 0); |
| 277 | 2397 if (p1 <= startp) |
| 2398 p1 = startp + 1; | |
| 2399 } | |
| 2400 | |
| 769 | 2401 if (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)) |
| 277 | 2402 { |
| 2403 endp++; | |
| 2404 if (p1 < startp) p1 = startp; | |
| 2405 while (p1 < endp) *p1++ = SPACEGLYPH; | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
2406 |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
2407 /* Don't draw vertical bars if we're using scroll bars. They're |
|
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
2408 covered up by the scroll bars, and it's distracting to see |
|
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
2409 them when the scroll bar windows are flickering around to be |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
2410 reconfigured. */ |
|
1992
37c45885540a
* xdisp.c (redisplay): Protect calls to request_sigio and
Jim Blandy <jimb@redhat.com>
parents:
1873
diff
changeset
|
2411 *p1++ = (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
2412 ? ' ' : '|'); |
| 277 | 2413 } |
| 2414 desired_glyphs->used[vpos] = max (desired_glyphs->used[vpos], | |
| 2415 p1 - desired_glyphs->glyphs[vpos]); | |
| 2416 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0; | |
| 2417 | |
| 2418 /* If the start of this line is the overlay arrow-position, | |
| 2419 then put the arrow string into the display-line. */ | |
| 2420 | |
| 2421 if (XTYPE (Voverlay_arrow_position) == Lisp_Marker | |
| 2422 && current_buffer == XMARKER (Voverlay_arrow_position)->buffer | |
| 2423 && start == marker_position (Voverlay_arrow_position) | |
| 2424 && XTYPE (Voverlay_arrow_string) == Lisp_String | |
| 2425 && ! overlay_arrow_seen) | |
| 2426 { | |
| 2427 unsigned char *p = XSTRING (Voverlay_arrow_string)->data; | |
| 2428 int i; | |
| 2429 int len = XSTRING (Voverlay_arrow_string)->size; | |
|
3726
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2430 int arrow_end; |
| 277 | 2431 |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
2432 if (len > width) |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
2433 len = width; |
| 277 | 2434 for (i = 0; i < len; i++) |
| 2435 startp[i] = p[i]; | |
|
3726
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2436 |
|
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2437 /* Bug in SunOS 4.1.1 compiler requires this intermediate variable. */ |
|
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2438 arrow_end = (startp - desired_glyphs->glyphs[vpos]) + len; |
|
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2439 if (desired_glyphs->used[vpos] < arrow_end) |
|
33e82e88a210
* xdisp.c (display_text_line): Use temporary variable.
Jim Blandy <jimb@redhat.com>
parents:
3689
diff
changeset
|
2440 desired_glyphs->used[vpos] = arrow_end; |
| 277 | 2441 |
| 2442 overlay_arrow_seen = 1; | |
| 2443 } | |
| 2444 | |
| 2445 val.bufpos = pos; | |
| 2446 val_display_text_line = val; | |
| 2447 return &val_display_text_line; | |
| 2448 } | |
| 2449 | |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2450 /* Redisplay the menu bar in the frame for window W. */ |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2451 |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2452 static void |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2453 display_menu_bar (w) |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2454 struct window *w; |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2455 { |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2456 Lisp_Object items, tail; |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2457 register int vpos = 0; |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2458 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2459 int maxendcol = FRAME_WIDTH (f); |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2460 int hpos = 0; |
|
6134
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2461 int i; |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2462 |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2463 #ifndef USE_X_TOOLKIT |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2464 if (FRAME_MENU_BAR_LINES (f) <= 0) |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2465 return; |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2466 |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2467 get_display_line (f, vpos, 0); |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2468 |
|
6134
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2469 items = FRAME_MENU_BAR_ITEMS (f); |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2470 for (i = 0; i < XVECTOR (items)->size; i += 3) |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2471 { |
|
6134
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2472 Lisp_Object pos, string; |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2473 string = XVECTOR (items)->contents[i + 1]; |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2474 if (NILP (string)) |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2475 break; |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2476 |
|
c656768172d2
(update_menu_bar): Change call to menu_bar_items.
Richard M. Stallman <rms@gnu.org>
parents:
6091
diff
changeset
|
2477 XFASTINT (XVECTOR (items)->contents[i + 2]) = hpos; |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2478 |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2479 if (hpos < maxendcol) |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2480 hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos, |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2481 XSTRING (string)->data, |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
2482 XSTRING (string)->size, |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2483 hpos, 0, 0, hpos, maxendcol); |
|
2189
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2484 /* Put a gap of 3 spaces between items. */ |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2485 if (hpos < maxendcol) |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2486 { |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2487 int hpos1 = hpos + 3; |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2488 hpos = display_string (w, vpos, "", 0, hpos, 0, 0, |
|
2189
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2489 min (hpos1, maxendcol), maxendcol); |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2490 } |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2491 } |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2492 |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2493 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0; |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2494 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video; |
|
2189
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2495 |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2496 /* Fill out the line with spaces. */ |
|
cb92d253a599
(display_menu_bar): Assume FRAME_MENU_BAR_ITEMS already set.
Richard M. Stallman <rms@gnu.org>
parents:
2150
diff
changeset
|
2497 if (maxendcol > hpos) |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2498 hpos = display_string (w, vpos, "", 0, hpos, 0, 0, maxendcol, maxendcol); |
|
4423
53f7c5b30816
* xdisp.c (display_menu_bar): Redisplay all lines occupied by the
Jim Blandy <jimb@redhat.com>
parents:
4386
diff
changeset
|
2499 |
|
53f7c5b30816
* xdisp.c (display_menu_bar): Redisplay all lines occupied by the
Jim Blandy <jimb@redhat.com>
parents:
4386
diff
changeset
|
2500 /* Clear the rest of the lines allocated to the menu bar. */ |
|
53f7c5b30816
* xdisp.c (display_menu_bar): Redisplay all lines occupied by the
Jim Blandy <jimb@redhat.com>
parents:
4386
diff
changeset
|
2501 vpos++; |
|
53f7c5b30816
* xdisp.c (display_menu_bar): Redisplay all lines occupied by the
Jim Blandy <jimb@redhat.com>
parents:
4386
diff
changeset
|
2502 while (vpos < FRAME_MENU_BAR_LINES (f)) |
|
53f7c5b30816
* xdisp.c (display_menu_bar): Redisplay all lines occupied by the
Jim Blandy <jimb@redhat.com>
parents:
4386
diff
changeset
|
2503 get_display_line (f, vpos++, 0); |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2504 #endif /* not USE_X_TOOLKIT */ |
|
2150
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2505 } |
|
cb8205e30dda
(display_menu_bar): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2065
diff
changeset
|
2506 |
| 277 | 2507 /* Display the mode line for window w */ |
| 2508 | |
| 2509 static void | |
| 2510 display_mode_line (w) | |
| 2511 struct window *w; | |
| 2512 { | |
| 2513 register int vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1; | |
| 2514 register int left = XFASTINT (w->left); | |
| 2515 register int right = XFASTINT (w->width) + left; | |
| 769 | 2516 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
| 277 | 2517 |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2518 line_number_displayed = 0; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2519 |
| 769 | 2520 get_display_line (f, vpos, left); |
| 277 | 2521 display_mode_element (w, vpos, left, 0, right, right, |
| 2522 current_buffer->mode_line_format); | |
| 769 | 2523 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0; |
| 277 | 2524 |
| 2525 /* Make the mode line inverse video if the entire line | |
| 2526 is made of mode lines. | |
| 2527 I.e. if this window is full width, | |
| 2528 or if it is the child of a full width window | |
| 2529 (which implies that that window is split side-by-side | |
| 2530 and the rest of this line is mode lines of the sibling windows). */ | |
| 769 | 2531 if (XFASTINT (w->width) == FRAME_WIDTH (f) |
| 2532 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f)) | |
| 2533 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video; | |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2534 #ifdef HAVE_X_WINDOWS |
|
6278
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2535 else if (! FRAME_TERMCAP_P (f)) |
|
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2536 { |
|
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2537 /* For a partial width window, explicitly set face of each glyph. */ |
|
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2538 int i; |
|
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2539 GLYPH *ptr = FRAME_DESIRED_GLYPHS (f)->glyphs[vpos]; |
|
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2540 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>
parents:
6372
diff
changeset
|
2541 ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1); |
|
6278
ab5b9470fd85
(display_mode_line): Highlight partial-width mode lines
Richard M. Stallman <rms@gnu.org>
parents:
6134
diff
changeset
|
2542 } |
|
6415
35917d3d0952
(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle
Karl Heuer <kwzh@gnu.org>
parents:
6372
diff
changeset
|
2543 #endif |
| 277 | 2544 |
| 2545 #ifdef HAVE_X_WINDOWS | |
|
6308
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
2546 if (w == XWINDOW (f->selected_window)) |
|
f34deea7dc2c
(x_consider_frame_title): New function, extracted from display_mode_line.
Karl Heuer <kwzh@gnu.org>
parents:
6278
diff
changeset
|
2547 x_consider_frame_title (WINDOW_FRAME (w)); |
| 277 | 2548 #endif |
| 2549 } | |
| 2550 | |
| 2551 /* Contribute ELT to the mode line for window W. | |
| 2552 How it translates into text depends on its data type. | |
| 2553 | |
| 2554 VPOS is the position of the mode line being displayed. | |
| 2555 | |
| 769 | 2556 HPOS is the position (absolute on frame) where this element's text |
| 277 | 2557 should start. The output is truncated automatically at the right |
| 2558 edge of window W. | |
| 2559 | |
| 2560 DEPTH is the depth in recursion. It is used to prevent | |
| 2561 infinite recursion here. | |
| 2562 | |
| 2563 MINENDCOL is the hpos before which the element may not end. | |
| 2564 The element is padded at the right with spaces if nec | |
| 2565 to reach this column. | |
| 2566 | |
| 2567 MAXENDCOL is the hpos past which this element may not extend. | |
| 2568 If MINENDCOL is > MAXENDCOL, MINENDCOL takes priority. | |
| 2569 (This is necessary to make nested padding and truncation work.) | |
| 2570 | |
| 2571 Returns the hpos of the end of the text generated by ELT. | |
| 2572 The next element will receive that value as its HPOS arg, | |
| 2573 so as to concatenate the elements. */ | |
| 2574 | |
| 2575 static int | |
| 2576 display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) | |
| 2577 struct window *w; | |
| 2578 register int vpos, hpos; | |
| 2579 int depth; | |
| 2580 int minendcol; | |
| 2581 register int maxendcol; | |
| 2582 register Lisp_Object elt; | |
| 2583 { | |
| 2584 tail_recurse: | |
| 2585 if (depth > 10) | |
| 2586 goto invalid; | |
| 2587 | |
| 2588 depth++; | |
| 2589 | |
| 2590 #ifdef SWITCH_ENUM_BUG | |
| 2591 switch ((int) XTYPE (elt)) | |
| 2592 #else | |
| 2593 switch (XTYPE (elt)) | |
| 2594 #endif | |
| 2595 { | |
| 2596 case Lisp_String: | |
| 2597 { | |
| 2598 /* A string: output it and check for %-constructs within it. */ | |
| 2599 register unsigned char c; | |
| 2600 register unsigned char *this = XSTRING (elt)->data; | |
| 2601 | |
| 2602 while (hpos < maxendcol && *this) | |
| 2603 { | |
| 2604 unsigned char *last = this; | |
| 2605 while ((c = *this++) != '\0' && c != '%') | |
| 2606 ; | |
| 2607 if (this - 1 != last) | |
| 2608 { | |
| 2609 register int lim = --this - last + hpos; | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2610 hpos = display_string (w, vpos, last, -1, hpos, 0, 1, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2611 hpos, min (lim, maxendcol)); |
| 277 | 2612 } |
| 2613 else /* c == '%' */ | |
| 2614 { | |
| 2615 register int spec_width = 0; | |
| 2616 | |
| 2617 /* We can't allow -ve args due to the "%-" construct */ | |
| 2618 /* Argument specifies minwidth but not maxwidth | |
| 2619 (maxwidth can be specified by | |
| 2620 (<negative-number> . <stuff>) mode-line elements) */ | |
| 2621 | |
| 2622 while ((c = *this++) >= '0' && c <= '9') | |
| 2623 { | |
| 2624 spec_width = spec_width * 10 + (c - '0'); | |
| 2625 } | |
| 2626 | |
| 2627 spec_width += hpos; | |
| 2628 if (spec_width > maxendcol) | |
| 2629 spec_width = maxendcol; | |
| 2630 | |
| 2631 if (c == 'M') | |
| 2632 hpos = display_mode_element (w, vpos, hpos, depth, | |
| 2633 spec_width, maxendcol, | |
| 2634 Vglobal_mode_string); | |
| 2635 else if (c != 0) | |
| 2636 hpos = display_string (w, vpos, | |
| 2637 decode_mode_spec (w, c, | |
| 2638 maxendcol - hpos), | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
2639 -1, |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2640 hpos, 0, 1, spec_width, maxendcol); |
| 277 | 2641 } |
| 2642 } | |
| 2643 } | |
| 2644 break; | |
| 2645 | |
| 2646 case Lisp_Symbol: | |
| 2647 /* A symbol: process the value of the symbol recursively | |
| 2648 as if it appeared here directly. Avoid error if symbol void. | |
| 2649 Special case: if value of symbol is a string, output the string | |
| 2650 literally. */ | |
| 2651 { | |
| 2652 register Lisp_Object tem; | |
| 2653 tem = Fboundp (elt); | |
| 485 | 2654 if (!NILP (tem)) |
| 277 | 2655 { |
| 2656 tem = Fsymbol_value (elt); | |
| 2657 /* If value is a string, output that string literally: | |
| 2658 don't check for % within it. */ | |
| 2659 if (XTYPE (tem) == Lisp_String) | |
| 2660 hpos = display_string (w, vpos, XSTRING (tem)->data, | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
2661 XSTRING (tem)->size, |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2662 hpos, 0, 1, minendcol, maxendcol); |
| 277 | 2663 /* Give up right away for nil or t. */ |
| 2664 else if (!EQ (tem, elt)) | |
| 2665 { elt = tem; goto tail_recurse; } | |
| 2666 } | |
| 2667 } | |
| 2668 break; | |
| 2669 | |
| 2670 case Lisp_Cons: | |
| 2671 { | |
| 2672 register Lisp_Object car, tem; | |
| 2673 | |
| 2674 /* A cons cell: three distinct cases. | |
| 2675 If first element is a string or a cons, process all the elements | |
| 2676 and effectively concatenate them. | |
| 2677 If first element is a negative number, truncate displaying cdr to | |
| 2678 at most that many characters. If positive, pad (with spaces) | |
| 2679 to at least that many characters. | |
| 2680 If first element is a symbol, process the cadr or caddr recursively | |
| 2681 according to whether the symbol's value is non-nil or nil. */ | |
| 2682 car = XCONS (elt)->car; | |
| 2683 if (XTYPE (car) == Lisp_Symbol) | |
| 2684 { | |
| 2685 tem = Fboundp (car); | |
| 2686 elt = XCONS (elt)->cdr; | |
| 2687 if (XTYPE (elt) != Lisp_Cons) | |
| 2688 goto invalid; | |
| 2689 /* elt is now the cdr, and we know it is a cons cell. | |
| 2690 Use its car if CAR has a non-nil value. */ | |
| 485 | 2691 if (!NILP (tem)) |
| 277 | 2692 { |
| 2693 tem = Fsymbol_value (car); | |
| 485 | 2694 if (!NILP (tem)) |
| 277 | 2695 { elt = XCONS (elt)->car; goto tail_recurse; } |
| 2696 } | |
| 2697 /* Symbol's value is nil (or symbol is unbound) | |
| 2698 Get the cddr of the original list | |
| 2699 and if possible find the caddr and use that. */ | |
| 2700 elt = XCONS (elt)->cdr; | |
| 485 | 2701 if (NILP (elt)) |
| 277 | 2702 break; |
| 2703 else if (XTYPE (elt) != Lisp_Cons) | |
| 2704 goto invalid; | |
| 2705 elt = XCONS (elt)->car; | |
| 2706 goto tail_recurse; | |
| 2707 } | |
| 2708 else if (XTYPE (car) == Lisp_Int) | |
| 2709 { | |
| 2710 register int lim = XINT (car); | |
| 2711 elt = XCONS (elt)->cdr; | |
| 2712 if (lim < 0) | |
| 2713 /* Negative int means reduce maximum width. | |
| 2714 DO NOT change MINENDCOL here! | |
| 2715 (20 -10 . foo) should truncate foo to 10 col | |
| 2716 and then pad to 20. */ | |
| 2717 maxendcol = min (maxendcol, hpos - lim); | |
| 2718 else if (lim > 0) | |
| 2719 { | |
| 2720 /* Padding specified. Don't let it be more than | |
| 2721 current maximum. */ | |
| 2722 lim += hpos; | |
| 2723 if (lim > maxendcol) | |
| 2724 lim = maxendcol; | |
| 2725 /* If that's more padding than already wanted, queue it. | |
| 2726 But don't reduce padding already specified even if | |
| 2727 that is beyond the current truncation point. */ | |
| 2728 if (lim > minendcol) | |
| 2729 minendcol = lim; | |
| 2730 } | |
| 2731 goto tail_recurse; | |
| 2732 } | |
| 2733 else if (XTYPE (car) == Lisp_String || XTYPE (car) == Lisp_Cons) | |
| 2734 { | |
| 2735 register int limit = 50; | |
| 2736 /* LIMIT is to protect against circular lists. */ | |
| 2737 while (XTYPE (elt) == Lisp_Cons && --limit > 0 | |
| 2738 && hpos < maxendcol) | |
| 2739 { | |
| 2740 hpos = display_mode_element (w, vpos, hpos, depth, | |
| 2741 hpos, maxendcol, | |
| 2742 XCONS (elt)->car); | |
| 2743 elt = XCONS (elt)->cdr; | |
| 2744 } | |
| 2745 } | |
| 2746 } | |
| 2747 break; | |
| 2748 | |
| 2749 default: | |
| 2750 invalid: | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2751 return (display_string (w, vpos, "*invalid*", -1, hpos, 0, 1, |
| 277 | 2752 minendcol, maxendcol)); |
| 2753 } | |
| 2754 | |
| 2755 end: | |
| 2756 if (minendcol > hpos) | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
2757 hpos = display_string (w, vpos, "", 0, hpos, 0, 1, minendcol, maxendcol); |
| 277 | 2758 return hpos; |
| 2759 } | |
| 2760 | |
| 2761 /* Return a string for the output of a mode line %-spec for window W, | |
| 2762 generated by character C and width MAXWIDTH. */ | |
| 2763 | |
|
1017
d42877206c0a
* xdisp.c (display_mode_line): Use x_implicitly_set_name here.
Jim Blandy <jimb@redhat.com>
parents:
973
diff
changeset
|
2764 static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; |
|
d42877206c0a
* xdisp.c (display_mode_line): Use x_implicitly_set_name here.
Jim Blandy <jimb@redhat.com>
parents:
973
diff
changeset
|
2765 |
| 277 | 2766 static char * |
| 2767 decode_mode_spec (w, c, maxwidth) | |
| 2768 struct window *w; | |
| 2769 register char c; | |
| 2770 register int maxwidth; | |
| 2771 { | |
|
6518
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6415
diff
changeset
|
2772 Lisp_Object obj; |
| 769 | 2773 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
| 2774 char *decode_mode_spec_buf = (char *) FRAME_TEMP_GLYPHS (f)->total_contents; | |
| 277 | 2775 |
|
6518
07ecb7a5c916
(x_consider_frame_title, decode_mode_spec): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6415
diff
changeset
|
2776 obj = Qnil; |
| 769 | 2777 if (maxwidth > FRAME_WIDTH (f)) |
| 2778 maxwidth = FRAME_WIDTH (f); | |
| 277 | 2779 |
| 2780 switch (c) | |
| 2781 { | |
| 2782 case 'b': | |
| 2783 obj = current_buffer->name; | |
| 2784 #if 0 | |
| 2785 if (maxwidth >= 3 && XSTRING (obj)->size > maxwidth) | |
| 2786 { | |
| 2787 bcopy (XSTRING (obj)->data, decode_mode_spec_buf, maxwidth - 1); | |
| 2788 decode_mode_spec_buf[maxwidth - 1] = '\\'; | |
| 2789 decode_mode_spec_buf[maxwidth] = '\0'; | |
| 2790 return decode_mode_spec_buf; | |
| 2791 } | |
| 2792 #endif | |
| 2793 break; | |
| 2794 | |
| 2795 case 'f': | |
| 2796 obj = current_buffer->filename; | |
| 2797 #if 0 | |
| 485 | 2798 if (NILP (obj)) |
| 277 | 2799 return "[none]"; |
| 2800 else if (XTYPE (obj) == Lisp_String && XSTRING (obj)->size > maxwidth) | |
| 2801 { | |
| 2802 bcopy ("...", decode_mode_spec_buf, 3); | |
| 2803 bcopy (XSTRING (obj)->data + XSTRING (obj)->size - maxwidth + 3, | |
| 2804 decode_mode_spec_buf + 3, maxwidth - 3); | |
| 2805 return decode_mode_spec_buf; | |
| 2806 } | |
| 2807 #endif | |
| 2808 break; | |
| 2809 | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2810 case 'l': |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2811 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2812 int startpos = marker_position (w->start); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2813 int line, linepos, topline; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2814 int nlines, junk; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2815 Lisp_Object tem; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2816 int height = XFASTINT (w->height); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2817 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2818 /* If we decided that this buffer isn't suitable for line numbers, |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2819 don't forget that too fast. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2820 if (EQ (w->base_line_pos, w->buffer)) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2821 return "??"; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2822 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2823 /* If the buffer is very big, don't waste time. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2824 if (ZV - BEGV > line_number_display_limit) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2825 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2826 w->base_line_pos = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2827 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2828 return "??"; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2829 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2830 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2831 if (!NILP (w->base_line_number) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2832 && !NILP (w->base_line_pos) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2833 && XFASTINT (w->base_line_pos) <= marker_position (w->start)) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2834 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2835 line = XFASTINT (w->base_line_number); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2836 linepos = XFASTINT (w->base_line_pos); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2837 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2838 else |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2839 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2840 line = 1; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2841 linepos = BEGV; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2842 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2843 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2844 /* Count lines from base line to window start position. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2845 nlines = display_count_lines (linepos, startpos, startpos, &junk); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2846 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2847 topline = nlines + line; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2848 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2849 /* Determine a new base line, if the old one is too close |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2850 or too far away, or if we did not have one. |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2851 "Too close" means it's plausible a scroll-down would |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2852 go back past it. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2853 if (startpos == BEGV) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2854 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2855 XFASTINT (w->base_line_number) = topline; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2856 XFASTINT (w->base_line_pos) = BEGV; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2857 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2858 else if (nlines < height + 25 || nlines > height * 3 + 50 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2859 || linepos == BEGV) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2860 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2861 int limit = BEGV; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2862 int position; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2863 int distance = (height * 2 + 30) * 200; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2864 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2865 if (startpos - distance > limit) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2866 limit = startpos - distance; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2867 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2868 nlines = display_count_lines (startpos, limit, |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2869 -(height * 2 + 30), |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2870 &position); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2871 /* If we couldn't find the lines we wanted within |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2872 200 chars per line, |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2873 give up on line numbers for this window. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2874 if (position == startpos - distance) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2875 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2876 w->base_line_pos = w->buffer; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2877 w->base_line_number = Qnil; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2878 return "??"; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2879 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2880 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2881 XFASTINT (w->base_line_number) = topline - nlines; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2882 XFASTINT (w->base_line_pos) = position; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2883 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2884 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2885 /* Now count lines from the start pos to point. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2886 nlines = display_count_lines (startpos, PT, PT, &junk); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2887 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2888 /* Record that we did display the line number. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2889 line_number_displayed = 1; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2890 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2891 /* Make the string to show. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2892 sprintf (decode_mode_spec_buf, "%d", topline + nlines); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2893 return decode_mode_spec_buf; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2894 } |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2895 break; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
2896 |
| 277 | 2897 case 'm': |
| 2898 obj = current_buffer->mode_name; | |
| 2899 break; | |
| 2900 | |
| 2901 case 'n': | |
| 2902 if (BEGV > BEG || ZV < Z) | |
| 2903 return " Narrow"; | |
| 2904 break; | |
| 2905 | |
| 2906 case '*': | |
| 485 | 2907 if (!NILP (current_buffer->read_only)) |
| 277 | 2908 return "%"; |
| 2909 if (MODIFF > current_buffer->save_modified) | |
| 2910 return "*"; | |
| 2911 return "-"; | |
| 2912 | |
|
5936
18c152c31e66
(decode_mode_spec): Support %+.
Richard M. Stallman <rms@gnu.org>
parents:
5903
diff
changeset
|
2913 case '+': |
|
18c152c31e66
(decode_mode_spec): Support %+.
Richard M. Stallman <rms@gnu.org>
parents:
5903
diff
changeset
|
2914 if (MODIFF > current_buffer->save_modified) |
|
18c152c31e66
(decode_mode_spec): Support %+.
Richard M. Stallman <rms@gnu.org>
parents:
5903
diff
changeset
|
2915 return "*"; |
|
18c152c31e66
(decode_mode_spec): Support %+.
Richard M. Stallman <rms@gnu.org>
parents:
5903
diff
changeset
|
2916 return "-"; |
|
18c152c31e66
(decode_mode_spec): Support %+.
Richard M. Stallman <rms@gnu.org>
parents:
5903
diff
changeset
|
2917 |
| 277 | 2918 case 's': |
| 2919 /* status of process */ | |
| 2920 obj = Fget_buffer_process (Fcurrent_buffer ()); | |
| 485 | 2921 if (NILP (obj)) |
| 277 | 2922 return "no process"; |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2923 #ifdef subprocesses |
| 277 | 2924 obj = Fsymbol_name (Fprocess_status (obj)); |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2925 #endif |
| 277 | 2926 break; |
| 2927 | |
|
5658
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2928 case 't': /* indicate TEXT or BINARY */ |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2929 #ifdef MSDOS |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2930 decode_mode_spec_buf[0] |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2931 = NILP (current_buffer->buffer_file_type) ? "T" : "B"; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2932 decode_mode_spec_buf[1] = 0; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2933 return decode_mode_spec_buf; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2934 #else /* not MSDOS */ |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2935 return "T"; |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2936 #endif /* not MSDOS */ |
|
4e3a6baa4750
(display_menu_bar): Add USE_X_TOOLKIT conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5340
diff
changeset
|
2937 |
| 277 | 2938 case 'p': |
| 2939 { | |
| 2940 int pos = marker_position (w->start); | |
| 2941 int total = ZV - BEGV; | |
| 2942 | |
| 2943 if (XFASTINT (w->window_end_pos) <= Z - ZV) | |
| 2944 { | |
| 2945 if (pos <= BEGV) | |
| 2946 return "All"; | |
| 2947 else | |
| 2948 return "Bottom"; | |
| 2949 } | |
| 2950 else if (pos <= BEGV) | |
| 2951 return "Top"; | |
| 2952 else | |
| 2953 { | |
| 2954 total = ((pos - BEGV) * 100 + total - 1) / total; | |
| 2955 /* We can't normally display a 3-digit number, | |
| 2956 so get us a 2-digit number that is close. */ | |
| 2957 if (total == 100) | |
| 2958 total = 99; | |
| 2959 sprintf (decode_mode_spec_buf, "%2d%%", total); | |
| 2960 return decode_mode_spec_buf; | |
| 2961 } | |
| 2962 } | |
| 2963 | |
|
5903
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2964 /* Display percentage of size above the bottom of the screen. */ |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2965 case 'P': |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2966 { |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2967 int toppos = marker_position (w->start); |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2968 int botpos = Z - XFASTINT (w->window_end_pos); |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2969 int total = ZV - BEGV; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2970 |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2971 if (botpos >= ZV) |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2972 { |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2973 if (toppos <= BEGV) |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2974 return "All"; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2975 else |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2976 return "Bottom"; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2977 } |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2978 else |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2979 { |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2980 total = ((botpos - BEGV) * 100 + total - 1) / total; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2981 /* We can't normally display a 3-digit number, |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2982 so get us a 2-digit number that is close. */ |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2983 if (total == 100) |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2984 total = 99; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2985 if (toppos <= BEGV) |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2986 sprintf (decode_mode_spec_buf, "Top%2d%%", total); |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2987 else |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2988 sprintf (decode_mode_spec_buf, "%2d%%", total); |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2989 return decode_mode_spec_buf; |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2990 } |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2991 } |
|
0aea60a8c2d5
(decode_mode_spec): Implement `P'.
Richard M. Stallman <rms@gnu.org>
parents:
5883
diff
changeset
|
2992 |
| 277 | 2993 case '%': |
| 2994 return "%"; | |
| 2995 | |
| 2996 case '[': | |
| 2997 { | |
| 2998 int i; | |
| 2999 char *p; | |
| 3000 | |
| 3001 if (command_loop_level > 5) | |
| 3002 return "[[[... "; | |
| 3003 p = decode_mode_spec_buf; | |
| 3004 for (i = 0; i < command_loop_level; i++) | |
| 3005 *p++ = '['; | |
| 3006 *p = 0; | |
| 3007 return decode_mode_spec_buf; | |
| 3008 } | |
| 3009 | |
| 3010 case ']': | |
| 3011 { | |
| 3012 int i; | |
| 3013 char *p; | |
| 3014 | |
| 3015 if (command_loop_level > 5) | |
| 3016 return " ...]]]"; | |
| 3017 p = decode_mode_spec_buf; | |
| 3018 for (i = 0; i < command_loop_level; i++) | |
| 3019 *p++ = ']'; | |
| 3020 *p = 0; | |
| 3021 return decode_mode_spec_buf; | |
| 3022 } | |
| 3023 | |
| 3024 case '-': | |
| 3025 { | |
| 3026 register char *p; | |
| 3027 register int i; | |
| 3028 | |
| 3029 if (maxwidth < sizeof (lots_of_dashes)) | |
| 3030 return lots_of_dashes; | |
| 3031 else | |
| 3032 { | |
| 3033 for (p = decode_mode_spec_buf, i = maxwidth; i > 0; i--) | |
| 3034 *p++ = '-'; | |
| 3035 *p = '\0'; | |
| 3036 } | |
| 3037 return decode_mode_spec_buf; | |
| 3038 } | |
| 3039 } | |
| 3040 | |
| 3041 if (XTYPE (obj) == Lisp_String) | |
| 3042 return (char *) XSTRING (obj)->data; | |
| 3043 else | |
| 3044 return ""; | |
| 3045 } | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3046 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3047 /* Count up to N lines starting from FROM. |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3048 But don't go beyond LIMIT. |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3049 Return the number of lines thus found (always positive). |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3050 Store the position after what was found into *POS_PTR. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3051 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3052 static int |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3053 display_count_lines (from, limit, n, pos_ptr) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3054 int from, limit, n; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3055 int *pos_ptr; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3056 { |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3057 int oldbegv = BEGV; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3058 int oldzv = ZV; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3059 int shortage = 0; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3060 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3061 if (limit < from) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3062 BEGV = limit; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3063 else |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3064 ZV = limit; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3065 |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3066 *pos_ptr = scan_buffer ('\n', from, n, &shortage, 0); |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3067 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3068 ZV = oldzv; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3069 BEGV = oldbegv; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3070 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3071 if (n < 0) |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3072 /* When scanning backwards, scan_buffer stops *after* the last newline |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3073 it finds, but does count it. Compensate for that. */ |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3074 return - n - shortage - (*pos_ptr != limit); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3075 return n - shortage; |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3076 } |
| 277 | 3077 |
| 3078 /* Display STRING on one line of window W, starting at HPOS. | |
| 3079 Display at position VPOS. Caller should have done get_display_line. | |
|
1017
d42877206c0a
* xdisp.c (display_mode_line): Use x_implicitly_set_name here.
Jim Blandy <jimb@redhat.com>
parents:
973
diff
changeset
|
3080 If VPOS == -1, display it as the current frame's title. |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3081 LENGTH is the length of STRING, or -1 meaning STRING is null-terminated. |
| 277 | 3082 |
| 3083 TRUNCATE is GLYPH to display at end if truncated. Zero for none. | |
| 3084 | |
| 3085 MINCOL is the first column ok to end at. (Pad with spaces to this col.) | |
| 3086 MAXCOL is the last column ok to end at. Truncate here. | |
| 3087 -1 for MINCOL or MAXCOL means no explicit minimum or maximum. | |
| 769 | 3088 Both count from the left edge of the frame, as does HPOS. |
| 277 | 3089 The right edge of W is an implicit maximum. |
| 3090 If TRUNCATE is nonzero, the implicit maximum is one column before the edge. | |
| 3091 | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3092 OBEY_WINDOW_WIDTH says to put spaces or vertical bars |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3093 at the place where the current window ends in this line |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3094 and not display anything beyond there. Otherwise, only MAXCOL |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3095 controls where to stop output. |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3096 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3097 Returns ending hpos. */ |
| 277 | 3098 |
| 3099 static int | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3100 display_string (w, vpos, string, length, hpos, truncate, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3101 obey_window_width, mincol, maxcol) |
| 277 | 3102 struct window *w; |
| 3103 unsigned char *string; | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3104 int length; |
| 277 | 3105 int vpos, hpos; |
| 3106 GLYPH truncate; | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3107 int obey_window_width; |
| 277 | 3108 int mincol, maxcol; |
| 3109 { | |
| 3110 register int c; | |
| 3111 register GLYPH *p1; | |
| 3112 int hscroll = XINT (w->hscroll); | |
|
1600
775c2ab9800f
* xdisp.c (display_string): Use w's buffer's value of
Jim Blandy <jimb@redhat.com>
parents:
1527
diff
changeset
|
3113 int tab_width = XINT (XBUFFER (w->buffer)->tab_width); |
| 277 | 3114 register GLYPH *start; |
| 3115 register GLYPH *end; | |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3116 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3117 struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f); |
| 277 | 3118 GLYPH *p1start = desired_glyphs->glyphs[vpos] + hpos; |
| 3119 int window_width = XFASTINT (w->width); | |
| 3120 | |
| 3121 /* Use the standard display table, not the window's display table. | |
| 3122 We don't want the mode line in rot13. */ | |
| 3123 register struct Lisp_Vector *dp = 0; | |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
3124 int i; |
| 277 | 3125 |
| 3126 if (XTYPE (Vstandard_display_table) == Lisp_Vector | |
| 3127 && XVECTOR (Vstandard_display_table)->size == DISP_TABLE_SIZE) | |
| 3128 dp = XVECTOR (Vstandard_display_table); | |
| 3129 | |
|
2324
24cd3df6f184
(display_string, display_text_line): Allow tab_width up to 1000.
Richard M. Stallman <rms@gnu.org>
parents:
2303
diff
changeset
|
3130 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
| 277 | 3131 |
| 3132 p1 = p1start; | |
| 3133 start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3134 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3135 if (obey_window_width) |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3136 { |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3137 end = start + window_width - (truncate != 0); |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3138 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3139 if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f)) |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3140 { |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3141 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3142 { |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3143 int i; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3144 |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3145 for (i = 0; i < VERTICAL_SCROLL_BAR_WIDTH; i++) |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3146 *end-- = ' '; |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3147 } |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3148 else |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3149 *end-- = '|'; |
|
1785
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3150 } |
|
19755499df90
* window.c (window_internal_width): New function, which accounts
Jim Blandy <jimb@redhat.com>
parents:
1718
diff
changeset
|
3151 } |
| 277 | 3152 |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3153 if (! obey_window_width |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3154 || (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol)) |
| 277 | 3155 end = desired_glyphs->glyphs[vpos] + maxcol; |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3156 |
|
6612
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
3157 /* Store 0 in charstart for these columns. */ |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
3158 for (i = hpos; i < end - p1start + hpos; i++) |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
3159 desired_glyphs->charstarts[vpos][i] = 0; |
|
1462bf31ef3c
(redisplay): Call frame_up_to_date_hook.
Richard M. Stallman <rms@gnu.org>
parents:
6568
diff
changeset
|
3160 |
| 277 | 3161 if (maxcol >= 0 && mincol > maxcol) |
| 3162 mincol = maxcol; | |
| 3163 | |
| 3164 while (p1 < end) | |
| 3165 { | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3166 if (length == 0) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3167 break; |
| 277 | 3168 c = *string++; |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3169 /* Specified length. */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3170 if (length >= 0) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3171 length--; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3172 /* Unspecified length (null-terminated string). */ |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3173 else if (c == 0) |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3174 break; |
|
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3175 |
| 277 | 3176 if (c >= 040 && c < 0177 |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
3177 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector)) |
| 277 | 3178 { |
| 3179 if (p1 >= start) | |
| 3180 *p1 = c; | |
| 3181 p1++; | |
| 3182 } | |
| 3183 else if (c == '\t') | |
| 3184 { | |
| 3185 do | |
| 3186 { | |
| 3187 if (p1 >= start && p1 < end) | |
| 3188 *p1 = SPACEGLYPH; | |
| 3189 p1++; | |
| 3190 } | |
| 3191 while ((p1 - start + hscroll - (hscroll > 0)) % tab_width); | |
| 3192 } | |
|
2065
32afcdd08efe
(copy_rope): Expect FROM to be a vector.
Richard M. Stallman <rms@gnu.org>
parents:
1992
diff
changeset
|
3193 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3194 { |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3195 p1 = copy_part_of_rope (f, p1, start, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3196 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3197 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3198 0); |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3199 } |
|
1527
00109911b040
* xdisp.c (redisplay): Use ! EQ to compare the old and new arrow
Jim Blandy <jimb@redhat.com>
parents:
1446
diff
changeset
|
3200 else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow)) |
| 277 | 3201 { |
| 3202 if (p1 >= start) | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3203 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3204 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3205 0); |
| 277 | 3206 p1++; |
| 368 | 3207 if (p1 >= start && p1 < end) |
| 277 | 3208 *p1 = c ^ 0100; |
| 3209 p1++; | |
| 3210 } | |
| 3211 else | |
| 3212 { | |
| 3213 if (p1 >= start) | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3214 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3215 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), |
|
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3216 0); |
| 277 | 3217 p1++; |
| 368 | 3218 if (p1 >= start && p1 < end) |
| 277 | 3219 *p1 = (c >> 6) + '0'; |
| 3220 p1++; | |
| 368 | 3221 if (p1 >= start && p1 < end) |
| 277 | 3222 *p1 = (7 & (c >> 3)) + '0'; |
| 3223 p1++; | |
| 368 | 3224 if (p1 >= start && p1 < end) |
| 277 | 3225 *p1 = (7 & c) + '0'; |
| 3226 p1++; | |
| 3227 } | |
| 3228 } | |
| 3229 | |
|
5230
8c30e49ddc04
(message): Use message2, not message1.
Richard M. Stallman <rms@gnu.org>
parents:
5082
diff
changeset
|
3230 if (c && length > 0) |
| 277 | 3231 { |
| 3232 p1 = end; | |
|
5800
295e342614a4
(fix_glyph): New function.
Richard M. Stallman <rms@gnu.org>
parents:
5739
diff
changeset
|
3233 if (truncate) *p1++ = fix_glyph (f, truncate, 0); |
| 277 | 3234 } |
| 3235 else if (mincol >= 0) | |
| 3236 { | |
| 3237 end = desired_glyphs->glyphs[vpos] + mincol; | |
| 3238 while (p1 < end) | |
| 3239 *p1++ = SPACEGLYPH; | |
| 3240 } | |
| 3241 | |
| 3242 { | |
| 3243 register int len = p1 - desired_glyphs->glyphs[vpos]; | |
| 3244 | |
| 3245 if (len > desired_glyphs->used[vpos]) | |
| 3246 desired_glyphs->used[vpos] = len; | |
| 3247 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0; | |
| 3248 | |
| 3249 return len; | |
| 3250 } | |
| 3251 } | |
| 3252 | |
| 3253 void | |
| 3254 syms_of_xdisp () | |
| 3255 { | |
| 3256 staticpro (&last_arrow_position); | |
| 3257 staticpro (&last_arrow_string); | |
| 3258 last_arrow_position = Qnil; | |
| 3259 last_arrow_string = Qnil; | |
| 3260 | |
| 3261 DEFVAR_LISP ("global-mode-string", &Vglobal_mode_string, | |
|
782
a6d00bdb2b60
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
781
diff
changeset
|
3262 "String (or mode line construct) included (normally) in `mode-line-format'."); |
| 277 | 3263 Vglobal_mode_string = Qnil; |
| 3264 | |
| 3265 DEFVAR_LISP ("overlay-arrow-position", &Voverlay_arrow_position, | |
| 3266 "Marker for where to display an arrow on top of the buffer text.\n\ | |
| 3267 This must be the beginning of a line in order to work.\n\ | |
| 3268 See also `overlay-arrow-string'."); | |
| 3269 Voverlay_arrow_position = Qnil; | |
| 3270 | |
| 3271 DEFVAR_LISP ("overlay-arrow-string", &Voverlay_arrow_string, | |
| 3272 "String to display as an arrow. See also `overlay-arrow-position'."); | |
| 3273 Voverlay_arrow_string = Qnil; | |
| 3274 | |
| 3275 DEFVAR_INT ("scroll-step", &scroll_step, | |
| 3276 "*The number of lines to try scrolling a window by when point moves out.\n\ | |
| 769 | 3277 If that fails to bring point back on frame, point is centered instead.\n\ |
| 3278 If this is zero, point is always centered after it moves off frame."); | |
| 277 | 3279 |
| 3280 DEFVAR_INT ("debug-end-pos", &debug_end_pos, "Don't ask"); | |
| 3281 | |
| 3282 DEFVAR_BOOL ("truncate-partial-width-windows", | |
| 3283 &truncate_partial_width_windows, | |
| 769 | 3284 "*Non-nil means truncate lines in all windows less than full frame wide."); |
| 277 | 3285 truncate_partial_width_windows = 1; |
| 3286 | |
| 3287 DEFVAR_BOOL ("mode-line-inverse-video", &mode_line_inverse_video, | |
| 3288 "*Non-nil means use inverse video for the mode line."); | |
| 3289 mode_line_inverse_video = 1; | |
|
2303
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3290 |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3291 DEFVAR_INT ("line-number-display-limit", &line_number_display_limit, |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3292 "*Maximum buffer size for which line number should be displayed."); |
|
00e3cc81c1be
(decode_mode_spec): Handle `%l'.
Richard M. Stallman <rms@gnu.org>
parents:
2252
diff
changeset
|
3293 line_number_display_limit = 1000000; |
|
3265
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
3294 |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
3295 DEFVAR_BOOL ("highlight-nonselected-windows", &highlight_nonselected_windows, |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
3296 "*Non-nil means highlight region even in nonselected windows."); |
|
80f57ae8d44e
(syms_of_xdisp): Make highlight-nonselected-windows Lisp var.
Richard M. Stallman <rms@gnu.org>
parents:
3165
diff
changeset
|
3297 highlight_nonselected_windows = 1; |
| 277 | 3298 } |
| 3299 | |
| 3300 /* initialize the window system */ | |
| 3301 init_xdisp () | |
| 3302 { | |
| 3303 Lisp_Object root_window; | |
| 3304 #ifndef COMPILER_REGISTER_BUG | |
| 3305 register | |
| 3306 #endif /* COMPILER_REGISTER_BUG */ | |
| 3307 struct window *mini_w; | |
| 3308 | |
| 3309 this_line_bufpos = 0; | |
| 3310 | |
| 3311 mini_w = XWINDOW (minibuf_window); | |
|
1017
d42877206c0a
* xdisp.c (display_mode_line): Use x_implicitly_set_name here.
Jim Blandy <jimb@redhat.com>
parents:
973
diff
changeset
|
3312 root_window = FRAME_ROOT_WINDOW (XFRAME (WINDOW_FRAME (mini_w))); |
| 277 | 3313 |
| 3314 echo_area_glyphs = 0; | |
| 3315 previous_echo_glyphs = 0; | |
| 3316 | |
| 3317 if (!noninteractive) | |
| 3318 { | |
| 769 | 3319 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (root_window))); |
| 277 | 3320 XFASTINT (XWINDOW (root_window)->top) = 0; |
| 769 | 3321 set_window_height (root_window, FRAME_HEIGHT (f) - 1, 0); |
| 3322 XFASTINT (mini_w->top) = FRAME_HEIGHT (f) - 1; | |
| 277 | 3323 set_window_height (minibuf_window, 1, 0); |
| 3324 | |
| 769 | 3325 XFASTINT (XWINDOW (root_window)->width) = FRAME_WIDTH (f); |
| 3326 XFASTINT (mini_w->width) = FRAME_WIDTH (f); | |
| 277 | 3327 } |
| 3328 } |
