Mercurial > emacs
annotate src/dispnew.c @ 13227:d8af44485b3c
(x_window, both versions): Add HAVE_X_I18N support.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 15 Oct 1995 15:17:33 +0000 |
parents | 2e9014617492 |
children | 7e92386e1cf7 |
rev | line source |
---|---|
314 | 1 /* Updating of data structures for redisplay. |
11235 | 2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc. |
314 | 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 | |
1777
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option) |
314 | 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 | |
21 #include <signal.h> | |
22 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4551
diff
changeset
|
23 #include <config.h> |
7900
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7814
diff
changeset
|
24 |
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7814
diff
changeset
|
25 #include <stdio.h> |
314 | 26 #include <ctype.h> |
27 | |
3525
58e789baa27a
Include lisp.h earlier (before termhooks.h).
Richard M. Stallman <rms@gnu.org>
parents:
3517
diff
changeset
|
28 #include "lisp.h" |
314 | 29 #include "termchar.h" |
30 #include "termopts.h" | |
2198 | 31 #include "termhooks.h" |
314 | 32 #include "cm.h" |
33 #include "dispextern.h" | |
34 #include "buffer.h" | |
764 | 35 #include "frame.h" |
314 | 36 #include "window.h" |
37 #include "commands.h" | |
38 #include "disptab.h" | |
39 #include "indent.h" | |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
40 #include "intervals.h" |
314 | 41 |
1042
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
42 #include "systty.h" |
12917 | 43 #include "syssignal.h" |
554 | 44 |
314 | 45 #ifdef HAVE_X_WINDOWS |
46 #include "xterm.h" | |
47 #endif /* HAVE_X_WINDOWS */ | |
48 | |
7808
52e2eb6245d4
Include systime.h after xterm.h.
Richard M. Stallman <rms@gnu.org>
parents:
7648
diff
changeset
|
49 /* Include systime.h after xterm.h to avoid double inclusion of time.h. */ |
52e2eb6245d4
Include systime.h after xterm.h.
Richard M. Stallman <rms@gnu.org>
parents:
7648
diff
changeset
|
50 #include "systime.h" |
52e2eb6245d4
Include systime.h after xterm.h.
Richard M. Stallman <rms@gnu.org>
parents:
7648
diff
changeset
|
51 |
7558
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
52 #include <errno.h> |
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
53 |
314 | 54 #define max(a, b) ((a) > (b) ? (a) : (b)) |
55 #define min(a, b) ((a) < (b) ? (a) : (b)) | |
56 | |
57 /* Get number of chars of output now in the buffer of a stdio stream. | |
58 This ought to be built in in stdio, but it isn't. | |
59 Some s- files override this because their stdio internals differ. */ | |
5214
c4bf07b226be
(PENDING_OUTPUT_COUNT) [__GNU_LIBRARY__]: Alternate definition for the GNU
Roland McGrath <roland@gnu.org>
parents:
5083
diff
changeset
|
60 #ifdef __GNU_LIBRARY__ |
7444 | 61 /* The s- file might have overridden the definition with one that works for |
62 the system's C library. But we are using the GNU C library, so this is | |
63 the right definition for every system. */ | |
7558
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
64 #ifdef GNU_LIBRARY_PENDING_OUTPUT_COUNT |
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
65 #define PENDING_OUTPUT_COUNT GNU_LIBRARY_PENDING_OUTPUT_COUNT |
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
66 #else |
7443
a9cb818e5316
[__GNU_LIBRARY__]: Redefine PENDING_OUTPUT_COUNT even if already defined.
Roland McGrath <roland@gnu.org>
parents:
7247
diff
changeset
|
67 #undef PENDING_OUTPUT_COUNT |
5214
c4bf07b226be
(PENDING_OUTPUT_COUNT) [__GNU_LIBRARY__]: Alternate definition for the GNU
Roland McGrath <roland@gnu.org>
parents:
5083
diff
changeset
|
68 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufp - (FILE)->__buffer) |
7558
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
69 #endif |
8497bcb9fb8e
(PENDING_OUTPUT_COUNT): If __GNU_LIBRARY__,
Richard M. Stallman <rms@gnu.org>
parents:
7530
diff
changeset
|
70 #else /* not __GNU_LIBRARY__ */ |
7443
a9cb818e5316
[__GNU_LIBRARY__]: Redefine PENDING_OUTPUT_COUNT even if already defined.
Roland McGrath <roland@gnu.org>
parents:
7247
diff
changeset
|
71 #ifndef PENDING_OUTPUT_COUNT |
314 | 72 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base) |
73 #endif | |
5214
c4bf07b226be
(PENDING_OUTPUT_COUNT) [__GNU_LIBRARY__]: Alternate definition for the GNU
Roland McGrath <roland@gnu.org>
parents:
5083
diff
changeset
|
74 #endif |
314 | 75 |
10770
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
76 static void change_frame_size_1 (); |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
77 |
554 | 78 /* Nonzero upon entry to redisplay means do not assume anything about |
764 | 79 current contents of actual terminal frame; clear and redraw it. */ |
314 | 80 |
764 | 81 int frame_garbaged; |
314 | 82 |
83 /* Nonzero means last display completed. Zero means it was preempted. */ | |
84 | |
85 int display_completed; | |
86 | |
87 /* Lisp variable visible-bell; enables use of screen-flash | |
88 instead of audible bell. */ | |
89 | |
90 int visible_bell; | |
91 | |
764 | 92 /* Invert the color of the whole frame, at a low level. */ |
314 | 93 |
94 int inverse_video; | |
95 | |
96 /* Line speed of the terminal. */ | |
97 | |
98 int baud_rate; | |
99 | |
100 /* nil or a symbol naming the window system under which emacs is | |
101 running ('x is the only current possibility). */ | |
102 | |
103 Lisp_Object Vwindow_system; | |
104 | |
105 /* Version number of X windows: 10, 11 or nil. */ | |
106 Lisp_Object Vwindow_system_version; | |
107 | |
108 /* Vector of glyph definitions. Indexed by glyph number, | |
109 the contents are a string which is how to output the glyph. | |
110 | |
111 If Vglyph_table is nil, a glyph is output by using its low 8 bits | |
112 as a character code. */ | |
113 | |
114 Lisp_Object Vglyph_table; | |
115 | |
116 /* Display table to use for vectors that don't specify their own. */ | |
117 | |
118 Lisp_Object Vstandard_display_table; | |
119 | |
120 /* Nonzero means reading single-character input with prompt | |
708 | 121 so put cursor on minibuffer after the prompt. |
122 positive means at end of text in echo area; | |
123 negative means at beginning of line. */ | |
314 | 124 int cursor_in_echo_area; |
13220
2e9014617492
(Qdisplay_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13105
diff
changeset
|
125 |
2e9014617492
(Qdisplay_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13105
diff
changeset
|
126 Lisp_Object Qdisplay_table; |
314 | 127 |
764 | 128 /* The currently selected frame. |
9572 | 129 In a single-frame version, this variable always holds the address of |
130 the_only_frame. */ | |
314 | 131 |
764 | 132 FRAME_PTR selected_frame; |
314 | 133 |
764 | 134 /* A frame which is not just a minibuffer, or 0 if there are no such |
135 frames. This is usually the most recent such frame that was | |
9572 | 136 selected. In a single-frame version, this variable always holds |
137 the address of the_only_frame. */ | |
764 | 138 FRAME_PTR last_nonminibuf_frame; |
732 | 139 |
764 | 140 /* In a single-frame version, the information that would otherwise |
986
83605f96f58e
* dispnew.c (the_only_frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
960
diff
changeset
|
141 exist inside frame objects lives in the following structure instead. |
83605f96f58e
* dispnew.c (the_only_frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
960
diff
changeset
|
142 |
83605f96f58e
* dispnew.c (the_only_frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
960
diff
changeset
|
143 NOTE: the_only_frame is not checked for garbage collection; don't |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3525
diff
changeset
|
144 store collectible objects in any of its fields! |
986
83605f96f58e
* dispnew.c (the_only_frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
960
diff
changeset
|
145 |
83605f96f58e
* dispnew.c (the_only_frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
960
diff
changeset
|
146 You're not/The only frame in town/... */ |
314 | 147 |
764 | 148 #ifndef MULTI_FRAME |
149 struct frame the_only_frame; | |
732 | 150 #endif |
314 | 151 |
152 /* This is a vector, made larger whenever it isn't large enough, | |
764 | 153 which is used inside `update_frame' to hold the old contents |
154 of the FRAME_PHYS_LINES of the frame being updated. */ | |
155 struct frame_glyphs **ophys_lines; | |
314 | 156 /* Length of vector currently allocated. */ |
157 int ophys_lines_length; | |
158 | |
159 FILE *termscript; /* Stdio stream being used for copy of all output. */ | |
160 | |
161 struct cm Wcm; /* Structure for info on cursor positioning */ | |
162 | |
163 extern short ospeed; /* Output speed (from sg_ospeed) */ | |
164 | |
165 int delayed_size_change; /* 1 means SIGWINCH happened when not safe. */ | |
166 | |
764 | 167 #ifdef MULTI_FRAME |
314 | 168 |
764 | 169 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, |
170 "Clear frame FRAME and output again what is supposed to appear on it.") | |
171 (frame) | |
172 Lisp_Object frame; | |
314 | 173 { |
764 | 174 FRAME_PTR f; |
314 | 175 |
764 | 176 CHECK_LIVE_FRAME (frame, 0); |
177 f = XFRAME (frame); | |
178 update_begin (f); | |
314 | 179 /* set_terminal_modes (); */ |
764 | 180 clear_frame (); |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
181 clear_frame_records (f); |
764 | 182 update_end (f); |
314 | 183 fflush (stdout); |
184 windows_or_buffers_changed++; | |
185 /* Mark all windows as INaccurate, | |
186 so that every window will have its redisplay done. */ | |
764 | 187 mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); |
188 f->garbaged = 0; | |
314 | 189 return Qnil; |
190 } | |
191 | |
764 | 192 redraw_frame (f) |
193 FRAME_PTR f; | |
314 | 194 { |
764 | 195 Lisp_Object frame; |
9264
9338a124ea84
(redraw_frame, Fsleep_for, sit_for, Fsit_for): Use new accessor macros instead
Karl Heuer <kwzh@gnu.org>
parents:
8903
diff
changeset
|
196 XSETFRAME (frame, f); |
764 | 197 Fredraw_frame (frame); |
314 | 198 } |
199 | |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
200 #else |
314 | 201 |
6349
c88bce6b48f0
(Fredraw_frame) [! MULTI_FRAME]: Make noninteractive, to be consistent with
Karl Heuer <kwzh@gnu.org>
parents:
6069
diff
changeset
|
202 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, |
11795
58e13b7bc232
[!MULTI_FRAME] (Fredraw_frame): Delete extra docstring.
Karl Heuer <kwzh@gnu.org>
parents:
11650
diff
changeset
|
203 /* Don't confuse make-docfile by having two doc strings for this function. |
58e13b7bc232
[!MULTI_FRAME] (Fredraw_frame): Delete extra docstring.
Karl Heuer <kwzh@gnu.org>
parents:
11650
diff
changeset
|
204 make-docfile does not pay attention to #if, for good reason! */ |
58e13b7bc232
[!MULTI_FRAME] (Fredraw_frame): Delete extra docstring.
Karl Heuer <kwzh@gnu.org>
parents:
11650
diff
changeset
|
205 0) |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
206 (frame) |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
207 Lisp_Object frame; |
314 | 208 { |
209 update_begin (0); | |
210 set_terminal_modes (); | |
764 | 211 clear_frame (); |
314 | 212 update_end (0); |
213 fflush (stdout); | |
764 | 214 clear_frame_records (0); |
314 | 215 windows_or_buffers_changed++; |
216 /* Mark all windows as INaccurate, | |
217 so that every window will have its redisplay done. */ | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
218 mark_window_display_accurate (FRAME_ROOT_WINDOW (0), 0); |
314 | 219 return Qnil; |
220 } | |
221 | |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
222 #endif |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
223 |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
224 DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
225 "Clear and redisplay all visible frames.") |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
226 () |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
227 { |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
228 Lisp_Object tail, frame; |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
229 |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
230 FOR_EACH_FRAME (tail, frame) |
3517
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
231 if (FRAME_VISIBLE_P (XFRAME (frame))) |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
232 Fredraw_frame (frame); |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
233 |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
234 return Qnil; |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
235 } |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
236 |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
237 /* This is used when frame_garbaged is set. |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
238 Redraw the individual frames marked as garbaged. */ |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
239 |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
240 void |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
241 redraw_garbaged_frames () |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
242 { |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
243 Lisp_Object tail, frame; |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
244 |
657a74662346
(Fredraw_display): Redraw all visible frames.
Richard M. Stallman <rms@gnu.org>
parents:
3449
diff
changeset
|
245 FOR_EACH_FRAME (tail, frame) |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
246 if (FRAME_VISIBLE_P (XFRAME (frame)) |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
247 && FRAME_GARBAGED_P (XFRAME (frame))) |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
248 Fredraw_frame (frame); |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
249 } |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
250 |
314 | 251 |
764 | 252 static struct frame_glyphs * |
253 make_frame_glyphs (frame, empty) | |
254 register FRAME_PTR frame; | |
314 | 255 int empty; |
256 { | |
257 register int i; | |
764 | 258 register width = FRAME_WIDTH (frame); |
259 register height = FRAME_HEIGHT (frame); | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
260 register struct frame_glyphs *new |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
261 = (struct frame_glyphs *) xmalloc (sizeof (struct frame_glyphs)); |
314 | 262 |
764 | 263 SET_GLYPHS_FRAME (new, frame); |
314 | 264 new->height = height; |
265 new->width = width; | |
266 new->used = (int *) xmalloc (height * sizeof (int)); | |
267 new->glyphs = (GLYPH **) xmalloc (height * sizeof (GLYPH *)); | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
268 new->charstarts = (int **) xmalloc (height * sizeof (int *)); |
314 | 269 new->highlight = (char *) xmalloc (height * sizeof (char)); |
270 new->enable = (char *) xmalloc (height * sizeof (char)); | |
271 bzero (new->enable, height * sizeof (char)); | |
272 new->bufp = (int *) xmalloc (height * sizeof (int)); | |
273 | |
274 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
275 if (FRAME_X_P (frame)) |
314 | 276 { |
277 new->top_left_x = (short *) xmalloc (height * sizeof (short)); | |
278 new->top_left_y = (short *) xmalloc (height * sizeof (short)); | |
279 new->pix_width = (short *) xmalloc (height * sizeof (short)); | |
280 new->pix_height = (short *) xmalloc (height * sizeof (short)); | |
1407
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
281 new->max_ascent = (short *) xmalloc (height * sizeof (short)); |
314 | 282 } |
283 #endif | |
284 | |
285 if (empty) | |
286 { | |
287 /* Make the buffer used by decode_mode_spec. This buffer is also | |
764 | 288 used as temporary storage when updating the frame. See scroll.c. */ |
314 | 289 unsigned int total_glyphs = (width + 2) * sizeof (GLYPH); |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
290 unsigned int total_charstarts = (width + 2) * sizeof (int); |
314 | 291 |
292 new->total_contents = (GLYPH *) xmalloc (total_glyphs); | |
293 bzero (new->total_contents, total_glyphs); | |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
294 |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
295 new->total_charstarts = (int *) xmalloc (total_charstarts); |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
296 bzero (new->total_charstarts, total_glyphs); |
314 | 297 } |
298 else | |
299 { | |
300 unsigned int total_glyphs = height * (width + 2) * sizeof (GLYPH); | |
301 | |
302 new->total_contents = (GLYPH *) xmalloc (total_glyphs); | |
303 bzero (new->total_contents, total_glyphs); | |
304 for (i = 0; i < height; i++) | |
305 new->glyphs[i] = new->total_contents + i * (width + 2) + 1; | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
306 |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
307 if (!FRAME_TERMCAP_P (frame)) |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
308 { |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
309 unsigned int total_charstarts = height * (width + 2) * sizeof (int); |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
310 |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
311 new->total_charstarts = (int *) xmalloc (total_charstarts); |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
312 bzero (new->total_charstarts, total_charstarts); |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
313 for (i = 0; i < height; i++) |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
314 new->charstarts[i] = new->total_charstarts + i * (width + 2) + 1; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
315 } |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
316 else |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
317 { |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
318 /* Without a window system, we don't really need charstarts. |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
319 So use a small amount of space to make enough data structure |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
320 to prevent crashes in display_text_line. */ |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
321 new->total_charstarts = (int *) xmalloc ((width + 2) * sizeof (int)); |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
322 for (i = 0; i < height; i++) |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
323 new->charstarts[i] = new->total_charstarts; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
324 } |
314 | 325 } |
326 | |
327 return new; | |
328 } | |
329 | |
8665
f06ea671bacb
(free_frame_glyphs): No longer static.
Richard M. Stallman <rms@gnu.org>
parents:
8395
diff
changeset
|
330 void |
764 | 331 free_frame_glyphs (frame, glyphs) |
332 FRAME_PTR frame; | |
333 struct frame_glyphs *glyphs; | |
314 | 334 { |
335 if (glyphs->total_contents) | |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
336 xfree (glyphs->total_contents); |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
337 if (glyphs->total_charstarts) |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
338 xfree (glyphs->total_charstarts); |
314 | 339 |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
340 xfree (glyphs->used); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
341 xfree (glyphs->glyphs); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
342 xfree (glyphs->highlight); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
343 xfree (glyphs->enable); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
344 xfree (glyphs->bufp); |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
345 if (glyphs->charstarts) |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
346 xfree (glyphs->charstarts); |
314 | 347 |
348 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
349 if (FRAME_X_P (frame)) |
314 | 350 { |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
351 xfree (glyphs->top_left_x); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
352 xfree (glyphs->top_left_y); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
353 xfree (glyphs->pix_width); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
354 xfree (glyphs->pix_height); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
355 xfree (glyphs->max_ascent); |
314 | 356 } |
357 #endif | |
358 | |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2365
diff
changeset
|
359 xfree (glyphs); |
314 | 360 } |
361 | |
10770
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
362 void |
764 | 363 remake_frame_glyphs (frame) |
364 FRAME_PTR frame; | |
314 | 365 { |
764 | 366 if (FRAME_CURRENT_GLYPHS (frame)) |
367 free_frame_glyphs (frame, FRAME_CURRENT_GLYPHS (frame)); | |
368 if (FRAME_DESIRED_GLYPHS (frame)) | |
369 free_frame_glyphs (frame, FRAME_DESIRED_GLYPHS (frame)); | |
370 if (FRAME_TEMP_GLYPHS (frame)) | |
371 free_frame_glyphs (frame, FRAME_TEMP_GLYPHS (frame)); | |
314 | 372 |
764 | 373 if (FRAME_MESSAGE_BUF (frame)) |
1872
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
374 { |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
375 /* Reallocate the frame's message buffer; remember that |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
376 echo_area_glyphs may be pointing here. */ |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
377 char *old_message_buf = FRAME_MESSAGE_BUF (frame); |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
378 |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
379 FRAME_MESSAGE_BUF (frame) |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
380 = (char *) xrealloc (FRAME_MESSAGE_BUF (frame), |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
381 FRAME_WIDTH (frame) + 1); |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
382 |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
383 if (echo_area_glyphs == old_message_buf) |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
384 echo_area_glyphs = FRAME_MESSAGE_BUF (frame); |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
385 if (previous_echo_glyphs == old_message_buf) |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
386 previous_echo_glyphs = FRAME_MESSAGE_BUF (frame); |
ad692b76edf4
* dispnew.c (remake_frame_glyphs): When re-allocating the frame's
Jim Blandy <jimb@redhat.com>
parents:
1849
diff
changeset
|
387 } |
314 | 388 else |
764 | 389 FRAME_MESSAGE_BUF (frame) |
390 = (char *) xmalloc (FRAME_WIDTH (frame) + 1); | |
314 | 391 |
764 | 392 FRAME_CURRENT_GLYPHS (frame) = make_frame_glyphs (frame, 0); |
393 FRAME_DESIRED_GLYPHS (frame) = make_frame_glyphs (frame, 0); | |
394 FRAME_TEMP_GLYPHS (frame) = make_frame_glyphs (frame, 1); | |
10770
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
395 if (! FRAME_TERMCAP_P (frame) || frame == selected_frame) |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
396 SET_FRAME_GARBAGED (frame); |
314 | 397 } |
398 | |
764 | 399 /* Return the hash code of contents of line VPOS in frame-matrix M. */ |
314 | 400 |
401 static int | |
402 line_hash_code (m, vpos) | |
764 | 403 register struct frame_glyphs *m; |
314 | 404 int vpos; |
405 { | |
406 register GLYPH *body, *end; | |
407 register int h = 0; | |
408 | |
409 if (!m->enable[vpos]) | |
410 return 0; | |
411 | |
1495
f17665e7347e
(count_blanks): Leave argument r constant, and increment p.
Richard M. Stallman <rms@gnu.org>
parents:
1407
diff
changeset
|
412 /* Give all highlighted lines the same hash code |
314 | 413 so as to encourage scrolling to leave them in place. */ |
414 if (m->highlight[vpos]) | |
415 return -1; | |
416 | |
417 body = m->glyphs[vpos]; | |
418 | |
419 if (must_write_spaces) | |
420 while (1) | |
421 { | |
422 GLYPH g = *body++; | |
423 | |
424 if (g == 0) | |
425 break; | |
426 h = (((h << 4) + (h >> 24)) & 0x0fffffff) + g - SPACEGLYPH; | |
427 } | |
428 else | |
429 while (1) | |
430 { | |
431 GLYPH g = *body++; | |
432 | |
433 if (g == 0) | |
434 break; | |
435 h = (((h << 4) + (h >> 24)) & 0x0fffffff) + g; | |
436 } | |
437 | |
438 if (h) | |
439 return h; | |
440 return 1; | |
441 } | |
442 | |
443 /* Return number of characters in line in M at vpos VPOS, | |
444 except don't count leading and trailing spaces | |
445 unless the terminal requires those to be explicitly output. */ | |
446 | |
447 static unsigned int | |
448 line_draw_cost (m, vpos) | |
764 | 449 struct frame_glyphs *m; |
314 | 450 int vpos; |
451 { | |
452 register GLYPH *beg = m->glyphs[vpos]; | |
453 register GLYPH *end = m->glyphs[vpos] + m->used[vpos]; | |
454 register int i; | |
455 register int tlen = GLYPH_TABLE_LENGTH; | |
456 register Lisp_Object *tbase = GLYPH_TABLE_BASE; | |
457 | |
458 /* Ignore trailing and leading spaces if we can. */ | |
459 if (!must_write_spaces) | |
460 { | |
461 while ((end != beg) && (*end == SPACEGLYPH)) | |
462 --end; | |
463 if (end == beg) | |
464 return (0); /* All blank line. */ | |
465 | |
466 while (*beg == SPACEGLYPH) | |
467 ++beg; | |
468 } | |
469 | |
470 /* If we don't have a glyph-table, each glyph is one character, | |
471 so return the number of glyphs. */ | |
472 if (tbase == 0) | |
473 return end - beg; | |
474 | |
475 /* Otherwise, scan the glyphs and accumulate their total size in I. */ | |
476 i = 0; | |
477 while ((beg <= end) && *beg) | |
478 { | |
479 register GLYPH g = *beg++; | |
480 | |
481 if (GLYPH_SIMPLE_P (tbase, tlen, g)) | |
482 i += 1; | |
483 else | |
484 i += GLYPH_LENGTH (tbase, g); | |
485 } | |
486 return i; | |
487 } | |
488 | |
489 /* The functions on this page are the interface from xdisp.c to redisplay. | |
490 | |
491 The only other interface into redisplay is through setting | |
764 | 492 FRAME_CURSOR_X (frame) and FRAME_CURSOR_Y (frame) |
493 and SET_FRAME_GARBAGED (frame). */ | |
314 | 494 |
495 /* cancel_line eliminates any request to display a line at position `vpos' */ | |
496 | |
764 | 497 cancel_line (vpos, frame) |
314 | 498 int vpos; |
764 | 499 register FRAME_PTR frame; |
314 | 500 { |
764 | 501 FRAME_DESIRED_GLYPHS (frame)->enable[vpos] = 0; |
314 | 502 } |
503 | |
764 | 504 clear_frame_records (frame) |
505 register FRAME_PTR frame; | |
314 | 506 { |
764 | 507 bzero (FRAME_CURRENT_GLYPHS (frame)->enable, FRAME_HEIGHT (frame)); |
314 | 508 } |
509 | |
11411
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
510 /* Clear out all display lines for a coming redisplay. */ |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
511 |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
512 void |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
513 init_desired_glyphs (frame) |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
514 register FRAME_PTR frame; |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
515 { |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
516 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (frame); |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
517 int vpos; |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
518 int height = FRAME_HEIGHT (frame); |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
519 |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
520 for (vpos = 0; vpos < height; vpos++) |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
521 desired_glyphs->enable[vpos] = 0; |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
522 } |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
523 |
314 | 524 /* Prepare to display on line VPOS starting at HPOS within it. */ |
525 | |
526 void | |
764 | 527 get_display_line (frame, vpos, hpos) |
528 register FRAME_PTR frame; | |
314 | 529 int vpos; |
530 register int hpos; | |
531 { | |
764 | 532 register struct frame_glyphs *glyphs; |
533 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (frame); | |
314 | 534 register GLYPH *p; |
535 | |
1192
5c380ec3cfc6
* dispnew.c (get_display_line): Don't abort if the frame is
Jim Blandy <jimb@redhat.com>
parents:
1042
diff
changeset
|
536 if (vpos < 0) |
314 | 537 abort (); |
538 | |
539 if (! desired_glyphs->enable[vpos]) | |
540 { | |
541 desired_glyphs->used[vpos] = 0; | |
542 desired_glyphs->highlight[vpos] = 0; | |
543 desired_glyphs->enable[vpos] = 1; | |
544 } | |
545 | |
546 if (hpos > desired_glyphs->used[vpos]) | |
547 { | |
548 GLYPH *g = desired_glyphs->glyphs[vpos] + desired_glyphs->used[vpos]; | |
549 GLYPH *end = desired_glyphs->glyphs[vpos] + hpos; | |
550 | |
551 desired_glyphs->used[vpos] = hpos; | |
552 while (g != end) | |
553 *g++ = SPACEGLYPH; | |
554 } | |
555 } | |
556 | |
557 /* Like bcopy except never gets confused by overlap. */ | |
558 | |
559 void | |
560 safe_bcopy (from, to, size) | |
561 char *from, *to; | |
562 int size; | |
563 { | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
564 if (size <= 0 || from == to) |
314 | 565 return; |
566 | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
567 /* If the source and destination don't overlap, then bcopy can |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
568 handle it. If they do overlap, but the destination is lower in |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
569 memory than the source, we'll assume bcopy can handle that. */ |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
570 if (to < from || from + size <= to) |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
571 bcopy (from, to, size); |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
572 |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
573 /* Otherwise, we'll copy from the end. */ |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
574 else |
314 | 575 { |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
576 register char *endf = from + size; |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
577 register char *endt = to + size; |
314 | 578 |
579 /* If TO - FROM is large, then we should break the copy into | |
580 nonoverlapping chunks of TO - FROM bytes each. However, if | |
581 TO - FROM is small, then the bcopy function call overhead | |
582 makes this not worth it. The crossover point could be about | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
583 anywhere. Since I don't think the obvious copy loop is too |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
584 bad, I'm trying to err in its favor. */ |
314 | 585 if (to - from < 64) |
586 { | |
587 do | |
588 *--endt = *--endf; | |
589 while (endf != from); | |
590 } | |
591 else | |
592 { | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
593 for (;;) |
314 | 594 { |
595 endt -= (to - from); | |
596 endf -= (to - from); | |
597 | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
598 if (endt < to) |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
599 break; |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
600 |
314 | 601 bcopy (endf, endt, to - from); |
602 } | |
1588
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
603 |
732a88db381f
* dispnew.c [not MULTI_FRAME] (Fredraw_display): Pass the correct
Jim Blandy <jimb@redhat.com>
parents:
1495
diff
changeset
|
604 /* If SIZE wasn't a multiple of TO - FROM, there will be a |
314 | 605 little left over. The amount left over is |
606 (endt + (to - from)) - to, which is endt - from. */ | |
607 bcopy (from, to, endt - from); | |
608 } | |
609 } | |
610 } | |
611 | |
352 | 612 /* Rotate a vector of SIZE bytes right, by DISTANCE bytes. |
314 | 613 DISTANCE may be negative. */ |
614 | |
615 static void | |
616 rotate_vector (vector, size, distance) | |
617 char *vector; | |
618 int size; | |
619 int distance; | |
620 { | |
621 char *temp = (char *) alloca (size); | |
622 | |
623 if (distance < 0) | |
624 distance += size; | |
625 | |
626 bcopy (vector, temp + distance, size - distance); | |
627 bcopy (vector + size - distance, temp, distance); | |
628 bcopy (temp, vector, size); | |
629 } | |
630 | |
631 /* Scroll lines from vpos FROM up to but not including vpos END | |
632 down by AMOUNT lines (AMOUNT may be negative). | |
633 Returns nonzero if done, zero if terminal cannot scroll them. */ | |
634 | |
635 int | |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
636 scroll_frame_lines (frame, from, end, amount, newpos) |
764 | 637 register FRAME_PTR frame; |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
638 int from, end, amount, newpos; |
314 | 639 { |
640 register int i; | |
764 | 641 register struct frame_glyphs *current_frame |
642 = FRAME_CURRENT_GLYPHS (frame); | |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
643 int pos_adjust; |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
644 int width = FRAME_WIDTH (frame); |
314 | 645 |
646 if (!line_ins_del_ok) | |
647 return 0; | |
648 | |
649 if (amount == 0) | |
650 return 1; | |
651 | |
652 if (amount > 0) | |
653 { | |
764 | 654 update_begin (frame); |
314 | 655 set_terminal_window (end + amount); |
656 if (!scroll_region_ok) | |
657 ins_del_lines (end, -amount); | |
658 ins_del_lines (from, amount); | |
659 set_terminal_window (0); | |
660 | |
764 | 661 rotate_vector (current_frame->glyphs + from, |
314 | 662 sizeof (GLYPH *) * (end + amount - from), |
663 amount * sizeof (GLYPH *)); | |
664 | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
665 rotate_vector (current_frame->charstarts + from, |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
666 sizeof (int *) * (end + amount - from), |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
667 amount * sizeof (int *)); |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
668 |
764 | 669 safe_bcopy (current_frame->used + from, |
670 current_frame->used + from + amount, | |
671 (end - from) * sizeof current_frame->used[0]); | |
314 | 672 |
764 | 673 safe_bcopy (current_frame->highlight + from, |
674 current_frame->highlight + from + amount, | |
675 (end - from) * sizeof current_frame->highlight[0]); | |
314 | 676 |
764 | 677 safe_bcopy (current_frame->enable + from, |
678 current_frame->enable + from + amount, | |
679 (end - from) * sizeof current_frame->enable[0]); | |
314 | 680 |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
681 /* Adjust the lines by an amount |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
682 that puts the first of them at NEWPOS. */ |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
683 pos_adjust = newpos - current_frame->charstarts[from + amount][0]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
684 |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
685 /* Offset each char position in the charstarts lines we moved |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
686 by pos_adjust. */ |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
687 for (i = from + amount; i < end + amount; i++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
688 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
689 int *line = current_frame->charstarts[i]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
690 int col; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
691 for (col = 0; col < width; col++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
692 if (line[col] > 0) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
693 line[col] += pos_adjust; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
694 } |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
695 for (i = from; i < from + amount; i++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
696 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
697 int *line = current_frame->charstarts[i]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
698 int col; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
699 line[0] = -1; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
700 for (col = 0; col < width; col++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
701 line[col] = 0; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
702 } |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
703 |
314 | 704 /* Mark the lines made empty by scrolling as enabled, empty and |
705 normal video. */ | |
764 | 706 bzero (current_frame->used + from, |
707 amount * sizeof current_frame->used[0]); | |
708 bzero (current_frame->highlight + from, | |
709 amount * sizeof current_frame->highlight[0]); | |
314 | 710 for (i = from; i < from + amount; i++) |
711 { | |
764 | 712 current_frame->glyphs[i][0] = '\0'; |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
713 current_frame->charstarts[i][0] = -1; |
764 | 714 current_frame->enable[i] = 1; |
314 | 715 } |
716 | |
764 | 717 safe_bcopy (current_frame->bufp + from, |
718 current_frame->bufp + from + amount, | |
719 (end - from) * sizeof current_frame->bufp[0]); | |
314 | 720 |
721 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
722 if (FRAME_X_P (frame)) |
314 | 723 { |
764 | 724 safe_bcopy (current_frame->top_left_x + from, |
725 current_frame->top_left_x + from + amount, | |
726 (end - from) * sizeof current_frame->top_left_x[0]); | |
314 | 727 |
764 | 728 safe_bcopy (current_frame->top_left_y + from, |
729 current_frame->top_left_y + from + amount, | |
730 (end - from) * sizeof current_frame->top_left_y[0]); | |
314 | 731 |
764 | 732 safe_bcopy (current_frame->pix_width + from, |
733 current_frame->pix_width + from + amount, | |
734 (end - from) * sizeof current_frame->pix_width[0]); | |
314 | 735 |
764 | 736 safe_bcopy (current_frame->pix_height + from, |
737 current_frame->pix_height + from + amount, | |
738 (end - from) * sizeof current_frame->pix_height[0]); | |
1407
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
739 |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
740 safe_bcopy (current_frame->max_ascent + from, |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
741 current_frame->max_ascent + from + amount, |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
742 (end - from) * sizeof current_frame->max_ascent[0]); |
314 | 743 } |
744 #endif /* HAVE_X_WINDOWS */ | |
745 | |
764 | 746 update_end (frame); |
314 | 747 } |
748 if (amount < 0) | |
749 { | |
764 | 750 update_begin (frame); |
314 | 751 set_terminal_window (end); |
752 ins_del_lines (from + amount, amount); | |
753 if (!scroll_region_ok) | |
754 ins_del_lines (end + amount, -amount); | |
755 set_terminal_window (0); | |
756 | |
764 | 757 rotate_vector (current_frame->glyphs + from + amount, |
314 | 758 sizeof (GLYPH *) * (end - from - amount), |
759 amount * sizeof (GLYPH *)); | |
760 | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
761 rotate_vector (current_frame->charstarts + from + amount, |
6627
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
762 sizeof (int *) * (end - from - amount), |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
763 amount * sizeof (int *)); |
f8471ecf787b
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
Richard M. Stallman <rms@gnu.org>
parents:
6620
diff
changeset
|
764 |
764 | 765 safe_bcopy (current_frame->used + from, |
766 current_frame->used + from + amount, | |
767 (end - from) * sizeof current_frame->used[0]); | |
314 | 768 |
764 | 769 safe_bcopy (current_frame->highlight + from, |
770 current_frame->highlight + from + amount, | |
771 (end - from) * sizeof current_frame->highlight[0]); | |
314 | 772 |
764 | 773 safe_bcopy (current_frame->enable + from, |
774 current_frame->enable + from + amount, | |
775 (end - from) * sizeof current_frame->enable[0]); | |
314 | 776 |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
777 /* Adjust the lines by an amount |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
778 that puts the first of them at NEWPOS. */ |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
779 pos_adjust = newpos - current_frame->charstarts[from + amount][0]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
780 |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
781 /* Offset each char position in the charstarts lines we moved |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
782 by pos_adjust. */ |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
783 for (i = from + amount; i < end + amount; i++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
784 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
785 int *line = current_frame->charstarts[i]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
786 int col; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
787 for (col = 0; col < width; col++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
788 if (line[col] > 0) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
789 line[col] += pos_adjust; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
790 } |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
791 for (i = end + amount; i < end; i++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
792 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
793 int *line = current_frame->charstarts[i]; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
794 int col; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
795 line[0] = -1; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
796 for (col = 0; col < width; col++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
797 line[col] = 0; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
798 } |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
799 |
314 | 800 /* Mark the lines made empty by scrolling as enabled, empty and |
801 normal video. */ | |
764 | 802 bzero (current_frame->used + end + amount, |
803 - amount * sizeof current_frame->used[0]); | |
804 bzero (current_frame->highlight + end + amount, | |
805 - amount * sizeof current_frame->highlight[0]); | |
314 | 806 for (i = end + amount; i < end; i++) |
807 { | |
764 | 808 current_frame->glyphs[i][0] = '\0'; |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
809 current_frame->charstarts[i][0] = 0; |
764 | 810 current_frame->enable[i] = 1; |
314 | 811 } |
812 | |
764 | 813 safe_bcopy (current_frame->bufp + from, |
814 current_frame->bufp + from + amount, | |
815 (end - from) * sizeof current_frame->bufp[0]); | |
314 | 816 |
817 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
818 if (FRAME_X_P (frame)) |
314 | 819 { |
764 | 820 safe_bcopy (current_frame->top_left_x + from, |
821 current_frame->top_left_x + from + amount, | |
822 (end - from) * sizeof current_frame->top_left_x[0]); | |
314 | 823 |
764 | 824 safe_bcopy (current_frame->top_left_y + from, |
825 current_frame->top_left_y + from + amount, | |
826 (end - from) * sizeof current_frame->top_left_y[0]); | |
314 | 827 |
764 | 828 safe_bcopy (current_frame->pix_width + from, |
829 current_frame->pix_width + from + amount, | |
830 (end - from) * sizeof current_frame->pix_width[0]); | |
314 | 831 |
764 | 832 safe_bcopy (current_frame->pix_height + from, |
833 current_frame->pix_height + from + amount, | |
834 (end - from) * sizeof current_frame->pix_height[0]); | |
1407
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
835 |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
836 safe_bcopy (current_frame->max_ascent + from, |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
837 current_frame->max_ascent + from + amount, |
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
838 (end - from) * sizeof current_frame->max_ascent[0]); |
314 | 839 } |
840 #endif /* HAVE_X_WINDOWS */ | |
841 | |
764 | 842 update_end (frame); |
314 | 843 } |
844 return 1; | |
845 } | |
846 | |
764 | 847 /* After updating a window W that isn't the full frame wide, |
314 | 848 copy all the columns that W does not occupy |
764 | 849 into the FRAME_DESIRED_GLYPHS (frame) from the FRAME_PHYS_GLYPHS (frame) |
850 so that update_frame will not change those columns. */ | |
314 | 851 |
852 preserve_other_columns (w) | |
853 struct window *w; | |
854 { | |
855 register int vpos; | |
764 | 856 register struct frame_glyphs *current_frame, *desired_frame; |
857 register FRAME_PTR frame = XFRAME (w->frame); | |
314 | 858 int start = XFASTINT (w->left); |
859 int end = XFASTINT (w->left) + XFASTINT (w->width); | |
860 int bot = XFASTINT (w->top) + XFASTINT (w->height); | |
861 | |
764 | 862 current_frame = FRAME_CURRENT_GLYPHS (frame); |
863 desired_frame = FRAME_DESIRED_GLYPHS (frame); | |
314 | 864 |
865 for (vpos = XFASTINT (w->top); vpos < bot; vpos++) | |
866 { | |
764 | 867 if (current_frame->enable[vpos] && desired_frame->enable[vpos]) |
314 | 868 { |
869 if (start > 0) | |
870 { | |
871 int len; | |
872 | |
764 | 873 bcopy (current_frame->glyphs[vpos], |
2930
839f3d132ee0
* dispnew.c (preserve_other_columns): Remember to multiply the
Jim Blandy <jimb@redhat.com>
parents:
2794
diff
changeset
|
874 desired_frame->glyphs[vpos], |
8878
066fab036ab5
(preserve_other_columns): Fix arg to sizeof in bcopy call.
Richard M. Stallman <rms@gnu.org>
parents:
8665
diff
changeset
|
875 start * sizeof (current_frame->glyphs[vpos][0])); |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
876 bcopy (current_frame->charstarts[vpos], |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
877 desired_frame->charstarts[vpos], |
8878
066fab036ab5
(preserve_other_columns): Fix arg to sizeof in bcopy call.
Richard M. Stallman <rms@gnu.org>
parents:
8665
diff
changeset
|
878 start * sizeof (current_frame->charstarts[vpos][0])); |
764 | 879 len = min (start, current_frame->used[vpos]); |
880 if (desired_frame->used[vpos] < len) | |
881 desired_frame->used[vpos] = len; | |
314 | 882 } |
764 | 883 if (current_frame->used[vpos] > end |
884 && desired_frame->used[vpos] < current_frame->used[vpos]) | |
314 | 885 { |
764 | 886 while (desired_frame->used[vpos] < end) |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
887 { |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
888 int used = desired_frame->used[vpos]++; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
889 desired_frame->glyphs[vpos][used] = SPACEGLYPH; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
890 desired_frame->glyphs[vpos][used] = 0; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
891 } |
764 | 892 bcopy (current_frame->glyphs[vpos] + end, |
893 desired_frame->glyphs[vpos] + end, | |
2930
839f3d132ee0
* dispnew.c (preserve_other_columns): Remember to multiply the
Jim Blandy <jimb@redhat.com>
parents:
2794
diff
changeset
|
894 ((current_frame->used[vpos] - end) |
8878
066fab036ab5
(preserve_other_columns): Fix arg to sizeof in bcopy call.
Richard M. Stallman <rms@gnu.org>
parents:
8665
diff
changeset
|
895 * sizeof (current_frame->glyphs[vpos][0]))); |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
896 bcopy (current_frame->charstarts[vpos] + end, |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
897 desired_frame->charstarts[vpos] + end, |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
898 ((current_frame->used[vpos] - end) |
8878
066fab036ab5
(preserve_other_columns): Fix arg to sizeof in bcopy call.
Richard M. Stallman <rms@gnu.org>
parents:
8665
diff
changeset
|
899 * sizeof (current_frame->charstarts[vpos][0]))); |
764 | 900 desired_frame->used[vpos] = current_frame->used[vpos]; |
314 | 901 } |
902 } | |
903 } | |
904 } | |
905 | |
906 #if 0 | |
907 | |
764 | 908 /* If window w does not need to be updated and isn't the full frame wide, |
314 | 909 copy all the columns that w does occupy |
764 | 910 into the FRAME_DESIRED_LINES (frame) from the FRAME_PHYS_LINES (frame) |
911 so that update_frame will not change those columns. | |
314 | 912 |
913 Have not been able to figure out how to use this correctly. */ | |
914 | |
915 preserve_my_columns (w) | |
916 struct window *w; | |
917 { | |
918 register int vpos, fin; | |
764 | 919 register struct frame_glyphs *l1, *l2; |
920 register FRAME_PTR frame = XFRAME (w->frame); | |
314 | 921 int start = XFASTINT (w->left); |
922 int end = XFASTINT (w->left) + XFASTINT (w->width); | |
923 int bot = XFASTINT (w->top) + XFASTINT (w->height); | |
924 | |
925 for (vpos = XFASTINT (w->top); vpos < bot; vpos++) | |
926 { | |
764 | 927 if ((l1 = FRAME_DESIRED_GLYPHS (frame)->glyphs[vpos + 1]) |
928 && (l2 = FRAME_PHYS_GLYPHS (frame)->glyphs[vpos + 1])) | |
314 | 929 { |
930 if (l2->length > start && l1->length < l2->length) | |
931 { | |
932 fin = l2->length; | |
933 if (fin > end) fin = end; | |
934 while (l1->length < start) | |
935 l1->body[l1->length++] = ' '; | |
936 bcopy (l2->body + start, l1->body + start, fin - start); | |
937 l1->length = fin; | |
938 } | |
939 } | |
940 } | |
941 } | |
942 | |
943 #endif | |
944 | |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
945 /* Adjust by ADJUST the charstart values in window W |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
946 after vpos VPOS, which counts relative to the frame |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
947 (not relative to W itself). */ |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
948 |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
949 void |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
950 adjust_window_charstarts (w, vpos, adjust) |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
951 struct window *w; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
952 int vpos; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
953 int adjust; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
954 { |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
955 int left = XFASTINT (w->left); |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
956 int top = XFASTINT (w->top); |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
957 int right = left + window_internal_width (w); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
958 int bottom = top + window_internal_height (w); |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
959 int i; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
960 |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
961 for (i = vpos + 1; i < bottom; i++) |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
962 { |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
963 int *charstart |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
964 = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i]; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
965 int j; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
966 for (j = left; j < right; j++) |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
967 if (charstart[j] > 0) |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
968 charstart[j] += adjust; |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
969 } |
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
970 } |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
971 |
6682
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
972 /* Check the charstarts values in the area of window W |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
973 for internal consistency. We cannot check that they are "right"; |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
974 we can only look for something nonsensical. */ |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
975 |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
976 verify_charstarts (w) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
977 struct window *w; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
978 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
979 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
980 int i; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
981 int top = XFASTINT (w->top); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
982 int bottom = top + window_internal_height (w); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
983 int left = XFASTINT (w->left); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
984 int right = left + window_internal_width (w); |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
985 int next_line; |
6682
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
986 int truncate = (XINT (w->hscroll) |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
987 || (truncate_partial_width_windows |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
988 && (XFASTINT (w->width) < FRAME_WIDTH (f))) |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
989 || !NILP (XBUFFER (w->buffer)->truncate_lines)); |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
990 |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
991 for (i = top; i < bottom; i++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
992 { |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
993 int j; |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
994 int last; |
6682
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
995 int *charstart = FRAME_CURRENT_GLYPHS (f)->charstarts[i]; |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
996 |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
997 if (i != top) |
6682
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
998 { |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
999 if (truncate) |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1000 { |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1001 /* If we are truncating lines, allow a jump |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1002 in charstarts from one line to the next. */ |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1003 if (charstart[left] < next_line) |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1004 abort (); |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1005 } |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1006 else |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1007 { |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1008 if (charstart[left] != next_line) |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1009 abort (); |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1010 } |
16ab14205588
(verify_charstarts): Handle truncation of lines.
Richard M. Stallman <rms@gnu.org>
parents:
6648
diff
changeset
|
1011 } |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1012 |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1013 for (j = left; j < right; j++) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1014 if (charstart[j] > 0) |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1015 last = charstart[j]; |
6645
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1016 /* Record where the next line should start. */ |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1017 next_line = last; |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1018 if (BUF_ZV (XBUFFER (w->buffer)) != last) |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1019 { |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1020 /* If there's a newline between the two lines, count that. */ |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1021 int endchar = *BUF_CHAR_ADDRESS (XBUFFER (w->buffer), last); |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1022 if (endchar == '\n') |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1023 next_line++; |
ba0c1af167e6
(verify_charstarts): Count right for continued lines.
Richard M. Stallman <rms@gnu.org>
parents:
6642
diff
changeset
|
1024 } |
6642
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1025 } |
2fda5dd17356
(verify_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6627
diff
changeset
|
1026 } |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
1027 |
314 | 1028 /* On discovering that the redisplay for a window was no good, |
1029 cancel the columns of that window, so that when the window is | |
1030 displayed over again get_display_line will not complain. */ | |
1031 | |
1032 cancel_my_columns (w) | |
1033 struct window *w; | |
1034 { | |
1035 register int vpos; | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1036 register struct frame_glyphs *desired_glyphs |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1037 = FRAME_DESIRED_GLYPHS (XFRAME (w->frame)); |
314 | 1038 register int start = XFASTINT (w->left); |
1039 register int bot = XFASTINT (w->top) + XFASTINT (w->height); | |
1040 | |
1041 for (vpos = XFASTINT (w->top); vpos < bot; vpos++) | |
1042 if (desired_glyphs->enable[vpos] | |
1043 && desired_glyphs->used[vpos] >= start) | |
1044 desired_glyphs->used[vpos] = start; | |
1045 } | |
1046 | |
764 | 1047 /* These functions try to perform directly and immediately on the frame |
314 | 1048 the necessary output for one change in the buffer. |
1049 They may return 0 meaning nothing was done if anything is difficult, | |
1050 or 1 meaning the output was performed properly. | |
764 | 1051 They assume that the frame was up to date before the buffer |
1495
f17665e7347e
(count_blanks): Leave argument r constant, and increment p.
Richard M. Stallman <rms@gnu.org>
parents:
1407
diff
changeset
|
1052 change being displayed. They make various other assumptions too; |
314 | 1053 see command_loop_1 where these are called. */ |
1054 | |
1055 int | |
1056 direct_output_for_insert (g) | |
1057 int g; | |
1058 { | |
764 | 1059 register FRAME_PTR frame = selected_frame; |
1060 register struct frame_glyphs *current_frame | |
1061 = FRAME_CURRENT_GLYPHS (frame); | |
314 | 1062 |
1063 #ifndef COMPILER_REGISTER_BUG | |
1064 register | |
1065 #endif /* COMPILER_REGISTER_BUG */ | |
1066 struct window *w = XWINDOW (selected_window); | |
1067 #ifndef COMPILER_REGISTER_BUG | |
1068 register | |
1069 #endif /* COMPILER_REGISTER_BUG */ | |
764 | 1070 int hpos = FRAME_CURSOR_X (frame); |
314 | 1071 #ifndef COMPILER_REGISTER_BUG |
1072 register | |
1073 #endif /* COMPILER_REGISTER_BUG */ | |
764 | 1074 int vpos = FRAME_CURSOR_Y (frame); |
314 | 1075 |
1777
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
1076 /* Give up if about to continue line. */ |
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
1077 if (hpos >= XFASTINT (w->left) + window_internal_width (w) - 1 |
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
1078 |
314 | 1079 /* Avoid losing if cursor is in invisible text off left margin */ |
1080 || (XINT (w->hscroll) && hpos == XFASTINT (w->left)) | |
1081 | |
1082 /* Give up if cursor outside window (in minibuf, probably) */ | |
1042
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1083 || cursor_in_echo_area |
764 | 1084 || FRAME_CURSOR_Y (frame) < XFASTINT (w->top) |
1085 || FRAME_CURSOR_Y (frame) >= XFASTINT (w->top) + XFASTINT (w->height) | |
314 | 1086 |
764 | 1087 /* Give up if cursor not really at FRAME_CURSOR_X, FRAME_CURSOR_Y */ |
314 | 1088 || !display_completed |
1089 | |
1090 /* Give up if buffer appears in two places. */ | |
1091 || buffer_shared > 1 | |
1092 | |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1093 #ifdef USE_TEXT_PROPERTIES |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1094 /* Intervals have already been adjusted, point is after the |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1095 character that was just inserted. */ |
6068
f67817990735
(direct_output_for_insert): Fix comment.
Karl Heuer <kwzh@gnu.org>
parents:
5885
diff
changeset
|
1096 /* Give up if character is invisible. */ |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1097 /* Give up if character has a face property. |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1098 At the moment we only lose at end of line or end of buffer |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1099 and only with faces that have some background */ |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1100 /* Instead of wasting time, give up if character has any text properties */ |
8903
03597c3eb63b
(direct_output_for_insert, direct_output_forward_char): Fix Lisp_Object
Karl Heuer <kwzh@gnu.org>
parents:
8878
diff
changeset
|
1101 || ! NILP (Ftext_properties_at (make_number (point - 1), Qnil)) |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1102 #endif |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1103 |
314 | 1104 /* Give up if w is minibuffer and a message is being displayed there */ |
1105 || (MINI_WINDOW_P (w) && echo_area_glyphs)) | |
1106 return 0; | |
1107 | |
2778
071fa2f469d7
* dispnew.c (direct_output_for_insert): Compute the face of the
Jim Blandy <jimb@redhat.com>
parents:
2648
diff
changeset
|
1108 { |
8301
c01188c50e70
(direct_output_for_insert): Dpn't call compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
8286
diff
changeset
|
1109 int face = 0; |
9572 | 1110 #ifdef HAVE_FACES |
2778
071fa2f469d7
* dispnew.c (direct_output_for_insert): Compute the face of the
Jim Blandy <jimb@redhat.com>
parents:
2648
diff
changeset
|
1111 int dummy; |
8301
c01188c50e70
(direct_output_for_insert): Dpn't call compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
8286
diff
changeset
|
1112 |
c01188c50e70
(direct_output_for_insert): Dpn't call compute_char_face
Richard M. Stallman <rms@gnu.org>
parents:
8286
diff
changeset
|
1113 if (FRAME_X_P (frame)) |
8394
b5d2495d6553
(direct_output_for_insert): Pass missing 8th
Richard M. Stallman <rms@gnu.org>
parents:
8301
diff
changeset
|
1114 face = compute_char_face (frame, w, point - 1, -1, -1, &dummy, point, 0); |
2778
071fa2f469d7
* dispnew.c (direct_output_for_insert): Compute the face of the
Jim Blandy <jimb@redhat.com>
parents:
2648
diff
changeset
|
1115 #endif |
6414
d681b16231a8
(direct_output_for_insert): Handle termcap frames as well as X.
Karl Heuer <kwzh@gnu.org>
parents:
6349
diff
changeset
|
1116 current_frame->glyphs[vpos][hpos] = MAKE_GLYPH (frame, g, face); |
6648
c7eefaee311c
(direct_output_for_insert): Add charstarts entry after the new char.
Richard M. Stallman <rms@gnu.org>
parents:
6645
diff
changeset
|
1117 current_frame->charstarts[vpos][hpos] = point - 1; |
c7eefaee311c
(direct_output_for_insert): Add charstarts entry after the new char.
Richard M. Stallman <rms@gnu.org>
parents:
6645
diff
changeset
|
1118 /* Record the entry for after the newly inserted character. */ |
c7eefaee311c
(direct_output_for_insert): Add charstarts entry after the new char.
Richard M. Stallman <rms@gnu.org>
parents:
6645
diff
changeset
|
1119 current_frame->charstarts[vpos][hpos + 1] = point; |
6620
990d7d5095dc
(adjust_window_charstarts): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6617
diff
changeset
|
1120 adjust_window_charstarts (w, vpos, 1); |
2778
071fa2f469d7
* dispnew.c (direct_output_for_insert): Compute the face of the
Jim Blandy <jimb@redhat.com>
parents:
2648
diff
changeset
|
1121 } |
314 | 1122 unchanged_modified = MODIFF; |
1123 beg_unchanged = GPT - BEG; | |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1124 XSETFASTINT (w->last_point, point); |
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1125 XSETFASTINT (w->last_point_x, hpos); |
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1126 XSETFASTINT (w->last_modified, MODIFF); |
314 | 1127 |
1128 reassert_line_highlight (0, vpos); | |
764 | 1129 write_glyphs (¤t_frame->glyphs[vpos][hpos], 1); |
314 | 1130 fflush (stdout); |
764 | 1131 ++FRAME_CURSOR_X (frame); |
1132 if (hpos == current_frame->used[vpos]) | |
314 | 1133 { |
764 | 1134 current_frame->used[vpos] = hpos + 1; |
1135 current_frame->glyphs[vpos][hpos + 1] = 0; | |
314 | 1136 } |
1137 | |
1138 return 1; | |
1139 } | |
1140 | |
1141 int | |
1142 direct_output_forward_char (n) | |
1143 int n; | |
1144 { | |
764 | 1145 register FRAME_PTR frame = selected_frame; |
314 | 1146 register struct window *w = XWINDOW (selected_window); |
8903
03597c3eb63b
(direct_output_for_insert, direct_output_forward_char): Fix Lisp_Object
Karl Heuer <kwzh@gnu.org>
parents:
8878
diff
changeset
|
1147 Lisp_Object position; |
5223
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1148 int hpos = FRAME_CURSOR_X (frame); |
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1149 |
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1150 /* Give up if in truncated text at end of line. */ |
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1151 if (hpos >= XFASTINT (w->left) + window_internal_width (w) - 1) |
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1152 return 0; |
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
1153 |
543 | 1154 /* Avoid losing if cursor is in invisible text off left margin |
1155 or about to go off either side of window. */ | |
764 | 1156 if ((FRAME_CURSOR_X (frame) == XFASTINT (w->left) |
543 | 1157 && (XINT (w->hscroll) || n < 0)) |
1158 || (n > 0 | |
1777
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
1159 && (FRAME_CURSOR_X (frame) + 1 >= window_internal_width (w) - 1)) |
1042
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1160 || cursor_in_echo_area) |
314 | 1161 return 0; |
11096
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1162 |
2794
9163e4e4752c
(direct_output_forward_char): Just give up
Richard M. Stallman <rms@gnu.org>
parents:
2778
diff
changeset
|
1163 /* Can't use direct output if highlighting a region. */ |
9163e4e4752c
(direct_output_forward_char): Just give up
Richard M. Stallman <rms@gnu.org>
parents:
2778
diff
changeset
|
1164 if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)) |
9163e4e4752c
(direct_output_forward_char): Just give up
Richard M. Stallman <rms@gnu.org>
parents:
2778
diff
changeset
|
1165 return 0; |
9163e4e4752c
(direct_output_forward_char): Just give up
Richard M. Stallman <rms@gnu.org>
parents:
2778
diff
changeset
|
1166 |
11096
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1167 /* Can't use direct output at an overlay boundary; it might have |
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1168 before-string or after-string properties. */ |
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1169 if (overlay_touches_p (PT) || overlay_touches_p (PT - n)) |
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1170 return 0; |
cac0367b1794
(direct_output_forward_char): Don't use direct output at an overlay boundary.
Karl Heuer <kwzh@gnu.org>
parents:
10770
diff
changeset
|
1171 |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1172 #ifdef USE_TEXT_PROPERTIES |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1173 /* Don't use direct output next to an invisible character |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1174 since we might need to do something special. */ |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1175 |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1176 XSETFASTINT (position, point); |
4551
1abd3007cbb6
(direct_output_forward_char): Fix previous change:
Richard M. Stallman <rms@gnu.org>
parents:
4384
diff
changeset
|
1177 if (XFASTINT (position) < ZV |
6069
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1178 && ! NILP (Fget_char_property (position, |
4551
1abd3007cbb6
(direct_output_forward_char): Fix previous change:
Richard M. Stallman <rms@gnu.org>
parents:
4384
diff
changeset
|
1179 Qinvisible, |
6069
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1180 selected_window))) |
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1181 return 0; |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1182 |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1183 XSETFASTINT (position, point - 1); |
4551
1abd3007cbb6
(direct_output_forward_char): Fix previous change:
Richard M. Stallman <rms@gnu.org>
parents:
4384
diff
changeset
|
1184 if (XFASTINT (position) >= BEGV |
6069
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1185 && ! NILP (Fget_char_property (position, |
4551
1abd3007cbb6
(direct_output_forward_char): Fix previous change:
Richard M. Stallman <rms@gnu.org>
parents:
4384
diff
changeset
|
1186 Qinvisible, |
6069
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1187 selected_window))) |
07045ca8ff19
(direct_output_forward_char): Use Fget_char_property to test for invisibility.
Karl Heuer <kwzh@gnu.org>
parents:
6068
diff
changeset
|
1188 return 0; |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1189 #endif |
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1190 |
764 | 1191 FRAME_CURSOR_X (frame) += n; |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1192 XSETFASTINT (w->last_point_x, FRAME_CURSOR_X (frame)); |
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
1193 XSETFASTINT (w->last_point, point); |
764 | 1194 cursor_to (FRAME_CURSOR_Y (frame), FRAME_CURSOR_X (frame)); |
314 | 1195 fflush (stdout); |
4384
98605d0ea3cf
(direct_output_for_insert): Fail if character
Richard M. Stallman <rms@gnu.org>
parents:
4290
diff
changeset
|
1196 |
314 | 1197 return 1; |
1198 } | |
1199 | |
1200 static void update_line (); | |
1201 | |
764 | 1202 /* Update frame F based on the data in FRAME_DESIRED_GLYPHS. |
314 | 1203 Value is nonzero if redisplay stopped due to pending input. |
1204 FORCE nonzero means do not stop for pending input. */ | |
1205 | |
1206 int | |
764 | 1207 update_frame (f, force, inhibit_hairy_id) |
1208 FRAME_PTR f; | |
314 | 1209 int force; |
1210 int inhibit_hairy_id; | |
1211 { | |
7179
cb958b7d5fe1
(update_frame): Move assignments to current_frame and desired_frame.
Richard M. Stallman <rms@gnu.org>
parents:
6857
diff
changeset
|
1212 register struct frame_glyphs *current_frame; |
7188
7da4ad9a2a8f
(update_frame): Move those assignments even farther down.
Richard M. Stallman <rms@gnu.org>
parents:
7179
diff
changeset
|
1213 register struct frame_glyphs *desired_frame = 0; |
314 | 1214 register int i; |
1215 int pause; | |
1216 int preempt_count = baud_rate / 2400 + 1; | |
1217 extern input_pending; | |
1218 #ifdef HAVE_X_WINDOWS | |
1219 register int downto, leftmost; | |
1220 #endif | |
1221 | |
10122
3de6776ae141
(update_frame): Call calculate_costs if baud_rate changed.
Richard M. Stallman <rms@gnu.org>
parents:
9963
diff
changeset
|
1222 if (baud_rate != FRAME_COST_BAUD_RATE (f)) |
3de6776ae141
(update_frame): Call calculate_costs if baud_rate changed.
Richard M. Stallman <rms@gnu.org>
parents:
9963
diff
changeset
|
1223 calculate_costs (f); |
3de6776ae141
(update_frame): Call calculate_costs if baud_rate changed.
Richard M. Stallman <rms@gnu.org>
parents:
9963
diff
changeset
|
1224 |
3357
d9523a958b3c
(update_frame): Make preempt_count positive.
Richard M. Stallman <rms@gnu.org>
parents:
3317
diff
changeset
|
1225 if (preempt_count <= 0) |
d9523a958b3c
(update_frame): Make preempt_count positive.
Richard M. Stallman <rms@gnu.org>
parents:
3317
diff
changeset
|
1226 preempt_count = 1; |
d9523a958b3c
(update_frame): Make preempt_count positive.
Richard M. Stallman <rms@gnu.org>
parents:
3317
diff
changeset
|
1227 |
764 | 1228 if (FRAME_HEIGHT (f) == 0) abort (); /* Some bug zeros some core */ |
314 | 1229 |
1230 detect_input_pending (); | |
1231 if (input_pending && !force) | |
1232 { | |
1233 pause = 1; | |
1234 goto do_pause; | |
1235 } | |
1236 | |
764 | 1237 update_begin (f); |
314 | 1238 |
1239 if (!line_ins_del_ok) | |
1240 inhibit_hairy_id = 1; | |
1241 | |
7188
7da4ad9a2a8f
(update_frame): Move those assignments even farther down.
Richard M. Stallman <rms@gnu.org>
parents:
7179
diff
changeset
|
1242 /* These are separate to avoid a possible bug in the AIX C compiler. */ |
7da4ad9a2a8f
(update_frame): Move those assignments even farther down.
Richard M. Stallman <rms@gnu.org>
parents:
7179
diff
changeset
|
1243 current_frame = FRAME_CURRENT_GLYPHS (f); |
7da4ad9a2a8f
(update_frame): Move those assignments even farther down.
Richard M. Stallman <rms@gnu.org>
parents:
7179
diff
changeset
|
1244 desired_frame = FRAME_DESIRED_GLYPHS (f); |
7da4ad9a2a8f
(update_frame): Move those assignments even farther down.
Richard M. Stallman <rms@gnu.org>
parents:
7179
diff
changeset
|
1245 |
493 | 1246 /* See if any of the desired lines are enabled; don't compute for |
1247 i/d line if just want cursor motion. */ | |
764 | 1248 for (i = 0; i < FRAME_HEIGHT (f); i++) |
1249 if (desired_frame->enable[i]) | |
314 | 1250 break; |
1251 | |
1252 /* Try doing i/d line, if not yet inhibited. */ | |
764 | 1253 if (!inhibit_hairy_id && i < FRAME_HEIGHT (f)) |
1254 force |= scrolling (f); | |
314 | 1255 |
1256 /* Update the individual lines as needed. Do bottom line first. */ | |
1257 | |
764 | 1258 if (desired_frame->enable[FRAME_HEIGHT (f) - 1]) |
1259 update_line (f, FRAME_HEIGHT (f) - 1); | |
314 | 1260 |
1261 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
1262 if (FRAME_X_P (f)) |
314 | 1263 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12627
diff
changeset
|
1264 leftmost = downto = f->output_data.x->internal_border_width; |
764 | 1265 if (desired_frame->enable[0]) |
314 | 1266 { |
764 | 1267 current_frame->top_left_x[FRAME_HEIGHT (f) - 1] = leftmost; |
1268 current_frame->top_left_y[FRAME_HEIGHT (f) - 1] | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12627
diff
changeset
|
1269 = PIXEL_HEIGHT (f) - f->output_data.x->internal_border_width |
1407
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
1270 - current_frame->pix_height[FRAME_HEIGHT (f) - 1]; |
764 | 1271 current_frame->top_left_x[0] = leftmost; |
1272 current_frame->top_left_y[0] = downto; | |
314 | 1273 } |
1274 } | |
1275 #endif /* HAVE_X_WINDOWS */ | |
1276 | |
1277 /* Now update the rest of the lines. */ | |
764 | 1278 for (i = 0; i < FRAME_HEIGHT (f) - 1 && (force || !input_pending); i++) |
314 | 1279 { |
764 | 1280 if (desired_frame->enable[i]) |
314 | 1281 { |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
1282 if (FRAME_TERMCAP_P (f)) |
314 | 1283 { |
1284 /* Flush out every so many lines. | |
1285 Also flush out if likely to have more than 1k buffered | |
1286 otherwise. I'm told that some telnet connections get | |
1287 really screwed by more than 1k output at once. */ | |
1288 int outq = PENDING_OUTPUT_COUNT (stdout); | |
1289 if (outq > 900 | |
1290 || (outq > 20 && ((i - 1) % preempt_count == 0))) | |
1291 { | |
1292 fflush (stdout); | |
1293 if (preempt_count == 1) | |
1294 { | |
554 | 1295 #ifdef EMACS_OUTQSIZE |
1296 if (EMACS_OUTQSIZE (0, &outq) < 0) | |
314 | 1297 /* Probably not a tty. Ignore the error and reset |
1298 * the outq count. */ | |
1299 outq = PENDING_OUTPUT_COUNT (stdout); | |
1300 #endif | |
1301 outq *= 10; | |
7530
57c2345a9002
(update_frame): Fix test of outq and baud_rate some more.
Richard M. Stallman <rms@gnu.org>
parents:
7529
diff
changeset
|
1302 if (baud_rate <= outq && baud_rate > 0) |
3357
d9523a958b3c
(update_frame): Make preempt_count positive.
Richard M. Stallman <rms@gnu.org>
parents:
3317
diff
changeset
|
1303 sleep (outq / baud_rate); |
314 | 1304 } |
1305 } | |
1306 if ((i - 1) % preempt_count == 0) | |
1307 detect_input_pending (); | |
1308 } | |
1309 | |
764 | 1310 update_line (f, i); |
314 | 1311 #ifdef HAVE_X_WINDOWS |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
1312 if (FRAME_X_P (f)) |
314 | 1313 { |
764 | 1314 current_frame->top_left_y[i] = downto; |
1315 current_frame->top_left_x[i] = leftmost; | |
314 | 1316 } |
1317 #endif /* HAVE_X_WINDOWS */ | |
1318 } | |
1319 | |
732 | 1320 #ifdef HAVE_X_WINDOWS |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
1321 if (FRAME_X_P (f)) |
1407
0f214040f708
* dispnew.c (scroll_frame_lines): All references to frame elements
Joseph Arceneaux <jla@gnu.org>
parents:
1192
diff
changeset
|
1322 downto += current_frame->pix_height[i]; |
732 | 1323 #endif |
314 | 1324 } |
764 | 1325 pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0; |
314 | 1326 |
1327 /* Now just clean up termcap drivers and set cursor, etc. */ | |
1328 if (!pause) | |
1329 { | |
12409
6e374b28ecc3
(update_frame): Pretend cursor is in echo area
Richard M. Stallman <rms@gnu.org>
parents:
12193
diff
changeset
|
1330 if ((cursor_in_echo_area |
12627
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1331 /* If we are showing a message instead of the minibuffer, |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1332 show the cursor for the message instead of for the |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1333 (now hidden) minibuffer contents. */ |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1334 || (EQ (minibuf_window, selected_window) |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1335 && EQ (minibuf_window, echo_area_window) |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1336 && echo_area_glyphs != 0)) |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1337 /* These cases apply only to the frame that contains |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1338 the active minibuffer window. */ |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1339 && FRAME_HAS_MINIBUF_P (f) |
c7bc7a24b1ff
(update_frame): Check that the echo area is in the frame being displayed.
Richard M. Stallman <rms@gnu.org>
parents:
12532
diff
changeset
|
1340 && EQ (FRAME_MINIBUF_WINDOW (f), minibuf_window)) |
708 | 1341 { |
1042
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1342 int top = XINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top); |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1343 int row, col; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1344 |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1345 if (cursor_in_echo_area < 0) |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1346 { |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1347 row = top; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1348 col = 0; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1349 } |
708 | 1350 else |
1042
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1351 { |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1352 /* If the minibuffer is several lines high, find the last |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1353 line that has any text on it. */ |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1354 row = FRAME_HEIGHT (f); |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1355 do |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1356 { |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1357 row--; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1358 if (current_frame->enable[row]) |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1359 col = current_frame->used[row]; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1360 else |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1361 col = 0; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1362 } |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1363 while (row > top && col == 0); |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1364 |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1365 if (col >= FRAME_WIDTH (f)) |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1366 { |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1367 col = 0; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1368 if (row < FRAME_HEIGHT (f) - 1) |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1369 row++; |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1370 } |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1371 } |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1372 |
41b77a76b885
* dispnew.c: Incude "systty.h", not "systerm.h".
Jim Blandy <jimb@redhat.com>
parents:
1003
diff
changeset
|
1373 cursor_to (row, col); |
708 | 1374 } |
314 | 1375 else |
764 | 1376 cursor_to (FRAME_CURSOR_Y (f), max (min (FRAME_CURSOR_X (f), |
1377 FRAME_WIDTH (f) - 1), 0)); | |
314 | 1378 } |
1379 | |
764 | 1380 update_end (f); |
314 | 1381 |
1382 if (termscript) | |
1383 fflush (termscript); | |
1384 fflush (stdout); | |
1385 | |
1386 /* Here if output is preempted because input is detected. */ | |
1387 do_pause: | |
1388 | |
764 | 1389 if (FRAME_HEIGHT (f) == 0) abort (); /* Some bug zeros some core */ |
314 | 1390 display_completed = !pause; |
1391 | |
7247
bead6db0bbf2
(update_frame): Fix previous change: unconditionally bzero at the end.
Richard M. Stallman <rms@gnu.org>
parents:
7188
diff
changeset
|
1392 bzero (FRAME_DESIRED_GLYPHS (f)->enable, FRAME_HEIGHT (f)); |
314 | 1393 return pause; |
1394 } | |
1395 | |
1396 /* Called when about to quit, to check for doing so | |
1397 at an improper time. */ | |
1398 | |
1399 void | |
1400 quit_error_check () | |
1401 { | |
13105
a9efbc138c23
(get_display_line): Don't abort if there's text
Richard M. Stallman <rms@gnu.org>
parents:
12917
diff
changeset
|
1402 #if 0 |
764 | 1403 if (FRAME_DESIRED_GLYPHS (selected_frame) == 0) |
314 | 1404 return; |
764 | 1405 if (FRAME_DESIRED_GLYPHS (selected_frame)->enable[0]) |
314 | 1406 abort (); |
764 | 1407 if (FRAME_DESIRED_GLYPHS (selected_frame)->enable[FRAME_HEIGHT (selected_frame) - 1]) |
314 | 1408 abort (); |
13105
a9efbc138c23
(get_display_line): Don't abort if there's text
Richard M. Stallman <rms@gnu.org>
parents:
12917
diff
changeset
|
1409 #endif |
314 | 1410 } |
1411 | |
1412 /* Decide what insert/delete line to do, and do it */ | |
1413 | |
1414 extern void scrolling_1 (); | |
1415 | |
764 | 1416 scrolling (frame) |
1417 FRAME_PTR frame; | |
314 | 1418 { |
1419 int unchanged_at_top, unchanged_at_bottom; | |
1420 int window_size; | |
1421 int changed_lines; | |
764 | 1422 int *old_hash = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); |
1423 int *new_hash = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | |
1424 int *draw_cost = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | |
10259
48e4dfc6bb43
(scrolling): Fewer restrictions if scroll_region_ok is
Richard M. Stallman <rms@gnu.org>
parents:
10122
diff
changeset
|
1425 int *old_draw_cost = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); |
314 | 1426 register int i; |
764 | 1427 int free_at_end_vpos = FRAME_HEIGHT (frame); |
1428 register struct frame_glyphs *current_frame = FRAME_CURRENT_GLYPHS (frame); | |
1429 register struct frame_glyphs *desired_frame = FRAME_DESIRED_GLYPHS (frame); | |
314 | 1430 |
1431 /* Compute hash codes of all the lines. | |
1432 Also calculate number of changed lines, | |
1433 number of unchanged lines at the beginning, | |
1434 and number of unchanged lines at the end. */ | |
1435 | |
1436 changed_lines = 0; | |
1437 unchanged_at_top = 0; | |
764 | 1438 unchanged_at_bottom = FRAME_HEIGHT (frame); |
1439 for (i = 0; i < FRAME_HEIGHT (frame); i++) | |
314 | 1440 { |
1441 /* Give up on this scrolling if some old lines are not enabled. */ | |
764 | 1442 if (!current_frame->enable[i]) |
314 | 1443 return 0; |
764 | 1444 old_hash[i] = line_hash_code (current_frame, i); |
1445 if (! desired_frame->enable[i]) | |
314 | 1446 new_hash[i] = old_hash[i]; |
1447 else | |
764 | 1448 new_hash[i] = line_hash_code (desired_frame, i); |
314 | 1449 |
1450 if (old_hash[i] != new_hash[i]) | |
1451 { | |
1452 changed_lines++; | |
764 | 1453 unchanged_at_bottom = FRAME_HEIGHT (frame) - i - 1; |
314 | 1454 } |
1455 else if (i == unchanged_at_top) | |
1456 unchanged_at_top++; | |
764 | 1457 draw_cost[i] = line_draw_cost (desired_frame, i); |
10259
48e4dfc6bb43
(scrolling): Fewer restrictions if scroll_region_ok is
Richard M. Stallman <rms@gnu.org>
parents:
10122
diff
changeset
|
1458 old_draw_cost[i] = line_draw_cost (current_frame, i); |
314 | 1459 } |
1460 | |
1461 /* If changed lines are few, don't allow preemption, don't scroll. */ | |
10259
48e4dfc6bb43
(scrolling): Fewer restrictions if scroll_region_ok is
Richard M. Stallman <rms@gnu.org>
parents:
10122
diff
changeset
|
1462 if (!scroll_region_ok && changed_lines < baud_rate / 2400 |
764 | 1463 || unchanged_at_bottom == FRAME_HEIGHT (frame)) |
314 | 1464 return 1; |
1465 | |
764 | 1466 window_size = (FRAME_HEIGHT (frame) - unchanged_at_top |
314 | 1467 - unchanged_at_bottom); |
1468 | |
1469 if (scroll_region_ok) | |
1470 free_at_end_vpos -= unchanged_at_bottom; | |
764 | 1471 else if (memory_below_frame) |
314 | 1472 free_at_end_vpos = -1; |
1473 | |
1474 /* If large window, fast terminal and few lines in common between | |
764 | 1475 current frame and desired frame, don't bother with i/d calc. */ |
10259
48e4dfc6bb43
(scrolling): Fewer restrictions if scroll_region_ok is
Richard M. Stallman <rms@gnu.org>
parents:
10122
diff
changeset
|
1476 if (!scroll_region_ok && window_size >= 18 && baud_rate > 2400 |
314 | 1477 && (window_size >= |
1478 10 * scrolling_max_lines_saved (unchanged_at_top, | |
764 | 1479 FRAME_HEIGHT (frame) - unchanged_at_bottom, |
314 | 1480 old_hash, new_hash, draw_cost))) |
1481 return 0; | |
1482 | |
764 | 1483 scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, |
314 | 1484 draw_cost + unchanged_at_top - 1, |
10259
48e4dfc6bb43
(scrolling): Fewer restrictions if scroll_region_ok is
Richard M. Stallman <rms@gnu.org>
parents:
10122
diff
changeset
|
1485 old_draw_cost + unchanged_at_top - 1, |
314 | 1486 old_hash + unchanged_at_top - 1, |
1487 new_hash + unchanged_at_top - 1, | |
1488 free_at_end_vpos - unchanged_at_top); | |
1489 | |
1490 return 0; | |
1491 } | |
1492 | |
1493 /* Return the offset in its buffer of the character at location col, line | |
1494 in the given window. */ | |
1495 int | |
1496 buffer_posn_from_coords (window, col, line) | |
1497 struct window *window; | |
1498 int col, line; | |
1499 { | |
5885
b649c51e3f6b
(buffer_posn_from_coords): Take hscroll into account.
Karl Heuer <kwzh@gnu.org>
parents:
5619
diff
changeset
|
1500 int hscroll = XINT (window->hscroll); |
314 | 1501 int window_left = XFASTINT (window->left); |
1502 | |
1503 /* The actual width of the window is window->width less one for the | |
493 | 1504 DISP_CONTINUE_GLYPH, and less one if it's not the rightmost |
1505 window. */ | |
1777
4edfaa19c7a7
* window.c (window_internal_width): New function.
Jim Blandy <jimb@redhat.com>
parents:
1766
diff
changeset
|
1506 int window_width = window_internal_width (window) - 1; |
314 | 1507 |
493 | 1508 int startp = marker_position (window->start); |
314 | 1509 |
1510 /* Since compute_motion will only operate on the current buffer, | |
1511 we need to save the old one and restore it when we're done. */ | |
1512 struct buffer *old_current_buffer = current_buffer; | |
493 | 1513 struct position *posn; |
314 | 1514 |
1515 current_buffer = XBUFFER (window->buffer); | |
1516 | |
11858
343ec791e9be
(buffer_posn_from_coords): Don't let startp be before BEGV.
Karl Heuer <kwzh@gnu.org>
parents:
11851
diff
changeset
|
1517 /* We can't get a correct result in this case, |
343ec791e9be
(buffer_posn_from_coords): Don't let startp be before BEGV.
Karl Heuer <kwzh@gnu.org>
parents:
11851
diff
changeset
|
1518 but at least prevent compute_motion from crashing. */ |
343ec791e9be
(buffer_posn_from_coords): Don't let startp be before BEGV.
Karl Heuer <kwzh@gnu.org>
parents:
11851
diff
changeset
|
1519 if (startp < BEGV) |
343ec791e9be
(buffer_posn_from_coords): Don't let startp be before BEGV.
Karl Heuer <kwzh@gnu.org>
parents:
11851
diff
changeset
|
1520 startp = BEGV; |
343ec791e9be
(buffer_posn_from_coords): Don't let startp be before BEGV.
Karl Heuer <kwzh@gnu.org>
parents:
11851
diff
changeset
|
1521 |
764 | 1522 /* It would be nice if we could use FRAME_CURRENT_GLYPHS (XFRAME |
1523 (window->frame))->bufp to avoid scanning from the very top of | |
493 | 1524 the window, but it isn't maintained correctly, and I'm not even |
1525 sure I will keep it. */ | |
1526 posn = compute_motion (startp, 0, | |
11851
b90c2cdd9627
(buffer_posn_from_coords): New arg to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
11795
diff
changeset
|
1527 ((window == XWINDOW (minibuf_window) && startp == BEG |
b90c2cdd9627
(buffer_posn_from_coords): New arg to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
11795
diff
changeset
|
1528 ? minibuf_prompt_width : 0) |
b90c2cdd9627
(buffer_posn_from_coords): New arg to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
11795
diff
changeset
|
1529 + (hscroll ? 1 - hscroll : 0)), |
b90c2cdd9627
(buffer_posn_from_coords): New arg to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
11795
diff
changeset
|
1530 0, |
3317
55066d2375b6
(buffer_posn_from_coords): Since COL is already
Richard M. Stallman <rms@gnu.org>
parents:
3192
diff
changeset
|
1531 ZV, line, col, |
6692
43a79400a664
Add window argument on calls to compute_motion.
Karl Heuer <kwzh@gnu.org>
parents:
6682
diff
changeset
|
1532 window_width, hscroll, 0, window); |
314 | 1533 |
1534 current_buffer = old_current_buffer; | |
1535 | |
764 | 1536 /* compute_motion considers frame points past the end of a line |
493 | 1537 to be *after* the newline, i.e. at the start of the next line. |
1538 This is reasonable, but not really what we want. So if the | |
1539 result is on a line below LINE, back it up one character. */ | |
1540 if (posn->vpos > line) | |
1541 return posn->bufpos - 1; | |
1542 else | |
1543 return posn->bufpos; | |
314 | 1544 } |
1545 | |
1546 static int | |
1547 count_blanks (r) | |
1548 register GLYPH *r; | |
1549 { | |
1550 register GLYPH *p = r; | |
1495
f17665e7347e
(count_blanks): Leave argument r constant, and increment p.
Richard M. Stallman <rms@gnu.org>
parents:
1407
diff
changeset
|
1551 while (*p++ == SPACEGLYPH); |
f17665e7347e
(count_blanks): Leave argument r constant, and increment p.
Richard M. Stallman <rms@gnu.org>
parents:
1407
diff
changeset
|
1552 return p - r - 1; |
314 | 1553 } |
1554 | |
1555 static int | |
1556 count_match (str1, str2) | |
1557 GLYPH *str1, *str2; | |
1558 { | |
1559 register GLYPH *p1 = str1; | |
1560 register GLYPH *p2 = str2; | |
1561 while (*p1++ == *p2++); | |
1562 return p1 - str1 - 1; | |
1563 } | |
1564 | |
1565 /* Char insertion/deletion cost vector, from term.c */ | |
1566 extern int *char_ins_del_vector; | |
1567 | |
1849
23ab36427257
(char_ins_del_cost): Use FRAME_WIDTH, not FRAME_HEIGHT.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
1568 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_WIDTH((f))]) |
314 | 1569 |
1570 static void | |
764 | 1571 update_line (frame, vpos) |
1572 register FRAME_PTR frame; | |
314 | 1573 int vpos; |
1574 { | |
1575 register GLYPH *obody, *nbody, *op1, *op2, *np1, *temp; | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1576 int *temp1; |
314 | 1577 int tem; |
1578 int osp, nsp, begmatch, endmatch, olen, nlen; | |
1579 int save; | |
764 | 1580 register struct frame_glyphs *current_frame |
1581 = FRAME_CURRENT_GLYPHS (frame); | |
1582 register struct frame_glyphs *desired_frame | |
1583 = FRAME_DESIRED_GLYPHS (frame); | |
314 | 1584 |
764 | 1585 if (desired_frame->highlight[vpos] |
1586 != (current_frame->enable[vpos] && current_frame->highlight[vpos])) | |
314 | 1587 { |
764 | 1588 change_line_highlight (desired_frame->highlight[vpos], vpos, |
1589 (current_frame->enable[vpos] ? | |
1590 current_frame->used[vpos] : 0)); | |
1591 current_frame->enable[vpos] = 0; | |
314 | 1592 } |
1593 else | |
764 | 1594 reassert_line_highlight (desired_frame->highlight[vpos], vpos); |
314 | 1595 |
764 | 1596 if (! current_frame->enable[vpos]) |
314 | 1597 { |
1598 olen = 0; | |
1599 } | |
1600 else | |
1601 { | |
764 | 1602 obody = current_frame->glyphs[vpos]; |
1603 olen = current_frame->used[vpos]; | |
1604 if (! current_frame->highlight[vpos]) | |
314 | 1605 { |
1606 if (!must_write_spaces) | |
1607 while (obody[olen - 1] == SPACEGLYPH && olen > 0) | |
1608 olen--; | |
1609 } | |
1610 else | |
1611 { | |
1612 /* For an inverse-video line, remember we gave it | |
764 | 1613 spaces all the way to the frame edge |
314 | 1614 so that the reverse video extends all the way across. */ |
1615 | |
764 | 1616 while (olen < FRAME_WIDTH (frame) - 1) |
314 | 1617 obody[olen++] = SPACEGLYPH; |
1618 } | |
1619 } | |
1620 | |
1621 /* One way or another, this will enable the line being updated. */ | |
764 | 1622 current_frame->enable[vpos] = 1; |
1623 current_frame->used[vpos] = desired_frame->used[vpos]; | |
1624 current_frame->highlight[vpos] = desired_frame->highlight[vpos]; | |
1625 current_frame->bufp[vpos] = desired_frame->bufp[vpos]; | |
314 | 1626 |
1627 #ifdef HAVE_X_WINDOWS | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
1628 if (FRAME_X_P (frame)) |
314 | 1629 { |
764 | 1630 current_frame->pix_width[vpos] |
1631 = current_frame->used[vpos] | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12627
diff
changeset
|
1632 * FONT_WIDTH (frame->output_data.x->font); |
764 | 1633 current_frame->pix_height[vpos] |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12627
diff
changeset
|
1634 = frame->output_data.x->line_height; |
314 | 1635 } |
1636 #endif /* HAVE_X_WINDOWS */ | |
1637 | |
764 | 1638 if (!desired_frame->enable[vpos]) |
314 | 1639 { |
1640 nlen = 0; | |
1641 goto just_erase; | |
1642 } | |
1643 | |
764 | 1644 nbody = desired_frame->glyphs[vpos]; |
1645 nlen = desired_frame->used[vpos]; | |
314 | 1646 |
1647 /* Pretend trailing spaces are not there at all, | |
1648 unless for one reason or another we must write all spaces. */ | |
764 | 1649 if (! desired_frame->highlight[vpos]) |
314 | 1650 { |
1651 if (!must_write_spaces) | |
1652 /* We know that the previous character byte contains 0. */ | |
1653 while (nbody[nlen - 1] == SPACEGLYPH) | |
1654 nlen--; | |
1655 } | |
1656 else | |
1657 { | |
1658 /* For an inverse-video line, give it extra trailing spaces | |
764 | 1659 all the way to the frame edge |
314 | 1660 so that the reverse video extends all the way across. */ |
1661 | |
764 | 1662 while (nlen < FRAME_WIDTH (frame) - 1) |
314 | 1663 nbody[nlen++] = SPACEGLYPH; |
1664 } | |
1665 | |
1666 /* If there's no i/d char, quickly do the best we can without it. */ | |
1667 if (!char_ins_del_ok) | |
1668 { | |
1669 int i,j; | |
1670 | |
4276
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1671 #if 0 |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1672 if (FRAME_X_P (frame)) |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1673 { |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1674 /* Under X, erase everything we are going to rewrite, |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1675 and rewrite everything from the first char that's changed. |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1676 This is part of supporting fonts like Courier |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1677 whose chars can overlap outside the char width. */ |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1678 for (i = 0; i < nlen; i++) |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1679 if (i >= olen || nbody[i] != obody[i]) |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1680 break; |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1681 |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1682 cursor_to (vpos, i); |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1683 if (i != olen) |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1684 clear_end_of_line (olen); |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1685 write_glyphs (nbody + i, nlen - i); |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1686 } |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1687 else |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1688 {} |
2298d2aff61c
Commented-out code added.
Richard M. Stallman <rms@gnu.org>
parents:
4134
diff
changeset
|
1689 #endif /* 0 */ |
314 | 1690 for (i = 0; i < nlen; i++) |
1691 { | |
1692 if (i >= olen || nbody[i] != obody[i]) /* A non-matching char. */ | |
1693 { | |
1694 cursor_to (vpos, i); | |
1695 for (j = 1; (i + j < nlen && | |
1696 (i + j >= olen || nbody[i+j] != obody[i+j])); | |
1697 j++); | |
1698 | |
1699 /* Output this run of non-matching chars. */ | |
1700 write_glyphs (nbody + i, j); | |
1701 i += j - 1; | |
1702 | |
1703 /* Now find the next non-match. */ | |
1704 } | |
1705 } | |
1706 | |
1707 /* Clear the rest of the line, or the non-clear part of it. */ | |
1708 if (olen > nlen) | |
1709 { | |
1710 cursor_to (vpos, nlen); | |
1711 clear_end_of_line (olen); | |
1712 } | |
1713 | |
764 | 1714 /* Exchange contents between current_frame and new_frame. */ |
1715 temp = desired_frame->glyphs[vpos]; | |
1716 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; | |
1717 current_frame->glyphs[vpos] = temp; | |
314 | 1718 |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1719 /* Exchange charstarts between current_frame and new_frame. */ |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1720 temp1 = desired_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1721 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1722 current_frame->charstarts[vpos] = temp1; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1723 |
314 | 1724 return; |
1725 } | |
1726 | |
1727 if (!olen) | |
1728 { | |
764 | 1729 nsp = (must_write_spaces || desired_frame->highlight[vpos]) |
314 | 1730 ? 0 : count_blanks (nbody); |
1731 if (nlen > nsp) | |
1732 { | |
1733 cursor_to (vpos, nsp); | |
1734 write_glyphs (nbody + nsp, nlen - nsp); | |
1735 } | |
1736 | |
764 | 1737 /* Exchange contents between current_frame and new_frame. */ |
1738 temp = desired_frame->glyphs[vpos]; | |
1739 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; | |
1740 current_frame->glyphs[vpos] = temp; | |
314 | 1741 |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1742 /* Exchange charstarts between current_frame and new_frame. */ |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1743 temp1 = desired_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1744 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1745 current_frame->charstarts[vpos] = temp1; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1746 |
314 | 1747 return; |
1748 } | |
1749 | |
1750 obody[olen] = 1; | |
1751 save = nbody[nlen]; | |
1752 nbody[nlen] = 0; | |
1753 | |
1754 /* Compute number of leading blanks in old and new contents. */ | |
1755 osp = count_blanks (obody); | |
764 | 1756 if (!desired_frame->highlight[vpos]) |
314 | 1757 nsp = count_blanks (nbody); |
1758 else | |
1759 nsp = 0; | |
1760 | |
1761 /* Compute number of matching chars starting with first nonblank. */ | |
1762 begmatch = count_match (obody + osp, nbody + nsp); | |
1763 | |
1764 /* Spaces in new match implicit space past the end of old. */ | |
1765 /* A bug causing this to be a no-op was fixed in 18.29. */ | |
1766 if (!must_write_spaces && osp + begmatch == olen) | |
1767 { | |
1768 np1 = nbody + nsp; | |
1769 while (np1[begmatch] == SPACEGLYPH) | |
1770 begmatch++; | |
1771 } | |
1772 | |
1773 /* Avoid doing insert/delete char | |
1774 just cause number of leading spaces differs | |
1775 when the following text does not match. */ | |
1776 if (begmatch == 0 && osp != nsp) | |
1777 osp = nsp = min (osp, nsp); | |
1778 | |
1779 /* Find matching characters at end of line */ | |
1780 op1 = obody + olen; | |
1781 np1 = nbody + nlen; | |
1782 op2 = op1 + begmatch - min (olen - osp, nlen - nsp); | |
1783 while (op1 > op2 && op1[-1] == np1[-1]) | |
1784 { | |
1785 op1--; | |
1786 np1--; | |
1787 } | |
1788 endmatch = obody + olen - op1; | |
1789 | |
1790 /* Put correct value back in nbody[nlen]. | |
1791 This is important because direct_output_for_insert | |
1792 can write into the line at a later point. | |
1793 If this screws up the zero at the end of the line, re-establish it. */ | |
1794 nbody[nlen] = save; | |
1795 obody[olen] = 0; | |
1796 | |
1797 /* tem gets the distance to insert or delete. | |
1798 endmatch is how many characters we save by doing so. | |
1799 Is it worth it? */ | |
1800 | |
1801 tem = (nlen - nsp) - (olen - osp); | |
1802 if (endmatch && tem | |
764 | 1803 && (!char_ins_del_ok || endmatch <= char_ins_del_cost (frame)[tem])) |
314 | 1804 endmatch = 0; |
1805 | |
1806 /* nsp - osp is the distance to insert or delete. | |
1807 If that is nonzero, begmatch is known to be nonzero also. | |
1808 begmatch + endmatch is how much we save by doing the ins/del. | |
1809 Is it worth it? */ | |
1810 | |
1811 if (nsp != osp | |
1812 && (!char_ins_del_ok | |
764 | 1813 || begmatch + endmatch <= char_ins_del_cost (frame)[nsp - osp])) |
314 | 1814 { |
1815 begmatch = 0; | |
1816 endmatch = 0; | |
1817 osp = nsp = min (osp, nsp); | |
1818 } | |
1819 | |
1820 /* Now go through the line, inserting, writing and | |
1821 deleting as appropriate. */ | |
1822 | |
1823 if (osp > nsp) | |
1824 { | |
1825 cursor_to (vpos, nsp); | |
1826 delete_glyphs (osp - nsp); | |
1827 } | |
1828 else if (nsp > osp) | |
1829 { | |
1830 /* If going to delete chars later in line | |
1831 and insert earlier in the line, | |
1832 must delete first to avoid losing data in the insert */ | |
1833 if (endmatch && nlen < olen + nsp - osp) | |
1834 { | |
1835 cursor_to (vpos, nlen - endmatch + osp - nsp); | |
1836 delete_glyphs (olen + nsp - osp - nlen); | |
1837 olen = nlen - (nsp - osp); | |
1838 } | |
1839 cursor_to (vpos, osp); | |
1840 insert_glyphs ((char *)0, nsp - osp); | |
1841 } | |
1842 olen += nsp - osp; | |
1843 | |
1844 tem = nsp + begmatch + endmatch; | |
1845 if (nlen != tem || olen != tem) | |
1846 { | |
1847 cursor_to (vpos, nsp + begmatch); | |
1848 if (!endmatch || nlen == olen) | |
1849 { | |
1850 /* If new text being written reaches right margin, | |
1851 there is no need to do clear-to-eol at the end. | |
1852 (and it would not be safe, since cursor is not | |
1853 going to be "at the margin" after the text is done) */ | |
764 | 1854 if (nlen == FRAME_WIDTH (frame)) |
314 | 1855 olen = 0; |
1856 write_glyphs (nbody + nsp + begmatch, nlen - tem); | |
1857 | |
1858 #ifdef obsolete | |
1859 | |
1860 /* the following code loses disastrously if tem == nlen. | |
1861 Rather than trying to fix that case, I am trying the simpler | |
1862 solution found above. */ | |
1863 | |
1864 /* If the text reaches to the right margin, | |
1865 it will lose one way or another (depending on AutoWrap) | |
1866 to clear to end of line after outputting all the text. | |
1867 So pause with one character to go and clear the line then. */ | |
764 | 1868 if (nlen == FRAME_WIDTH (frame) && fast_clear_end_of_line && olen > nlen) |
314 | 1869 { |
1870 /* endmatch must be zero, and tem must equal nsp + begmatch */ | |
1871 write_glyphs (nbody + tem, nlen - tem - 1); | |
1872 clear_end_of_line (olen); | |
1873 olen = 0; /* Don't let it be cleared again later */ | |
1874 write_glyphs (nbody + nlen - 1, 1); | |
1875 } | |
1876 else | |
1877 write_glyphs (nbody + nsp + begmatch, nlen - tem); | |
1878 #endif /* OBSOLETE */ | |
1879 | |
1880 } | |
1881 else if (nlen > olen) | |
1882 { | |
1883 write_glyphs (nbody + nsp + begmatch, olen - tem); | |
1884 insert_glyphs (nbody + nsp + begmatch + olen - tem, nlen - olen); | |
1885 olen = nlen; | |
1886 } | |
1887 else if (olen > nlen) | |
1888 { | |
1889 write_glyphs (nbody + nsp + begmatch, nlen - tem); | |
1890 delete_glyphs (olen - nlen); | |
1891 olen = nlen; | |
1892 } | |
1893 } | |
1894 | |
1895 just_erase: | |
1896 /* If any unerased characters remain after the new line, erase them. */ | |
1897 if (olen > nlen) | |
1898 { | |
1899 cursor_to (vpos, nlen); | |
1900 clear_end_of_line (olen); | |
1901 } | |
1902 | |
764 | 1903 /* Exchange contents between current_frame and new_frame. */ |
1904 temp = desired_frame->glyphs[vpos]; | |
1905 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; | |
1906 current_frame->glyphs[vpos] = temp; | |
6617
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1907 |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1908 /* Exchange charstarts between current_frame and new_frame. */ |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1909 temp1 = desired_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1910 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; |
6309d97ee4bc
(scroll_frame_lines): Handle charstarts like glyphs.
Richard M. Stallman <rms@gnu.org>
parents:
6414
diff
changeset
|
1911 current_frame->charstarts[vpos] = temp1; |
314 | 1912 } |
1913 | |
12193 | 1914 /* A vector of size >= 2 * NFRAMES + 3 * NBUFFERS + 1, containing the |
1915 session's frames, frame names, buffers, buffer-read-only flags, and | |
1916 buffer-modified-flags, and a trailing sentinel (so we don't need to | |
1917 add length checks). */ | |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1918 static Lisp_Object frame_and_buffer_state; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1919 |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1920 DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p, |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1921 Sframe_or_buffer_changed_p, 0, 0, 0, |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1922 "Return non-nil if the frame and buffer state appears to have changed.\n\ |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1923 The state variable is an internal vector containing all frames and buffers,\n\ |
11411
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1924 aside from buffers whose names start with space,\n\ |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1925 along with the buffers' read-only and modified flags, which allows a fast\n\ |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1926 check to see whether the menu bars might need to be recomputed.\n\ |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1927 If this function returns non-nil, it updates the internal vector to reflect\n\ |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1928 the current state.\n") |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1929 () |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1930 { |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1931 Lisp_Object tail, frame, buf; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1932 Lisp_Object *vecp; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1933 int n; |
11919
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1934 |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1935 vecp = XVECTOR (frame_and_buffer_state)->contents; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1936 FOR_EACH_FRAME (tail, frame) |
11919
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1937 { |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1938 if (!EQ (*vecp++, frame)) |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1939 goto changed; |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1940 if (!EQ (*vecp++, XFRAME (frame)->name)) |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1941 goto changed; |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1942 } |
9650
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1943 /* Check that the buffer info matches. |
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1944 No need to test for the end of the vector |
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1945 because the last element of the vector is lambda |
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1946 and that will always cause a mismatch. */ |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1947 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1948 { |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1949 buf = XCONS (XCONS (tail)->car)->cdr; |
11411
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1950 /* Ignore buffers that aren't included in buffer lists. */ |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1951 if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1952 continue; |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1953 if (!EQ (*vecp++, buf)) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1954 goto changed; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1955 if (!EQ (*vecp++, XBUFFER (buf)->read_only)) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1956 goto changed; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1957 if (!EQ (*vecp++, Fbuffer_modified_p (buf))) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1958 goto changed; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1959 } |
9650
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1960 /* Detect deletion of a buffer at the end of the list. */ |
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1961 if (*vecp == Qlambda) |
4295137050dd
(Fframe_or_buffer_changed_p):
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
1962 return Qnil; |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1963 changed: |
9963 | 1964 /* Start with 1 so there is room for at least one lambda at the end. */ |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1965 n = 1; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1966 FOR_EACH_FRAME (tail, frame) |
12186
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1967 n += 2; |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1968 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1969 n += 3; |
7814
e1e536773850
(Fframe_or_buffer_changed_p): Reuse the state vector.
Karl Heuer <kwzh@gnu.org>
parents:
7810
diff
changeset
|
1970 /* Reallocate the vector if it's grown, or if it's shrunk a lot. */ |
e1e536773850
(Fframe_or_buffer_changed_p): Reuse the state vector.
Karl Heuer <kwzh@gnu.org>
parents:
7810
diff
changeset
|
1971 if (n > XVECTOR (frame_and_buffer_state)->size |
12186
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1972 || n + 20 < XVECTOR (frame_and_buffer_state)->size / 2) |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1973 /* Add 20 extra so we grow it less often. */ |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1974 frame_and_buffer_state = Fmake_vector (make_number (n + 20), Qlambda); |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1975 vecp = XVECTOR (frame_and_buffer_state)->contents; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1976 FOR_EACH_FRAME (tail, frame) |
11919
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1977 { |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1978 *vecp++ = frame; |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1979 *vecp++ = XFRAME (frame)->name; |
31cb053405f2
(Fframe_or_buffer_changed_p): Record frame names
Karl Heuer <kwzh@gnu.org>
parents:
11914
diff
changeset
|
1980 } |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1981 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1982 { |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1983 buf = XCONS (XCONS (tail)->car)->cdr; |
11411
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1984 /* Ignore buffers that aren't included in buffer lists. */ |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1985 if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') |
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
1986 continue; |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1987 *vecp++ = buf; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1988 *vecp++ = XBUFFER (buf)->read_only; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1989 *vecp++ = Fbuffer_modified_p (buf); |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
1990 } |
12186
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1991 /* Fill up the vector with lambdas (always at least one). */ |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1992 *vecp++ = Qlambda; |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1993 while (vecp - XVECTOR (frame_and_buffer_state)->contents |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1994 < XVECTOR (frame_and_buffer_state)->size) |
7814
e1e536773850
(Fframe_or_buffer_changed_p): Reuse the state vector.
Karl Heuer <kwzh@gnu.org>
parents:
7810
diff
changeset
|
1995 *vecp++ = Qlambda; |
12186
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1996 /* Make sure we didn't overflow the vector. */ |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1997 if (vecp - XVECTOR (frame_and_buffer_state)->contents |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1998 > XVECTOR (frame_and_buffer_state)->size) |
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
1999 abort (); |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2000 return Qt; |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2001 } |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2002 |
314 | 2003 DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, |
2004 1, 1, "FOpen termscript file: ", | |
2005 "Start writing all terminal output to FILE as well as the terminal.\n\ | |
2006 FILE = nil means just close any termscript file currently open.") | |
2007 (file) | |
2008 Lisp_Object file; | |
2009 { | |
2010 if (termscript != 0) fclose (termscript); | |
2011 termscript = 0; | |
2012 | |
493 | 2013 if (! NILP (file)) |
314 | 2014 { |
2015 file = Fexpand_file_name (file, Qnil); | |
2016 termscript = fopen (XSTRING (file)->data, "w"); | |
2017 if (termscript == 0) | |
2018 report_file_error ("Opening termscript", Fcons (file, Qnil)); | |
2019 } | |
2020 return Qnil; | |
2021 } | |
2022 | |
2023 | |
2024 #ifdef SIGWINCH | |
493 | 2025 SIGTYPE |
10745
a553a08f5785
(window_change_signal): Add ignored argument.
Richard M. Stallman <rms@gnu.org>
parents:
10259
diff
changeset
|
2026 window_change_signal (signalnum) /* If we don't have an argument, */ |
a553a08f5785
(window_change_signal): Add ignored argument.
Richard M. Stallman <rms@gnu.org>
parents:
10259
diff
changeset
|
2027 int signalnum; /* some compilers complain in signal calls. */ |
314 | 2028 { |
2029 int width, height; | |
2030 extern int errno; | |
2031 int old_errno = errno; | |
2032 | |
764 | 2033 get_frame_size (&width, &height); |
314 | 2034 |
764 | 2035 /* The frame size change obviously applies to a termcap-controlled |
2036 frame. Find such a frame in the list, and assume it's the only | |
314 | 2037 one (since the redisplay code always writes to stdout, not a |
764 | 2038 FILE * specified in the frame structure). Record the new size, |
314 | 2039 but don't reallocate the data structures now. Let that be done |
2040 later outside of the signal handler. */ | |
2041 | |
2042 { | |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2043 Lisp_Object tail, frame; |
314 | 2044 |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2045 FOR_EACH_FRAME (tail, frame) |
314 | 2046 { |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2047 if (FRAME_TERMCAP_P (XFRAME (frame))) |
314 | 2048 { |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2049 change_frame_size (XFRAME (frame), height, width, 0, 1); |
314 | 2050 break; |
2051 } | |
2052 } | |
2053 } | |
2054 | |
2055 signal (SIGWINCH, window_change_signal); | |
2056 errno = old_errno; | |
2057 } | |
2058 #endif /* SIGWINCH */ | |
2059 | |
2060 | |
764 | 2061 /* Do any change in frame size that was requested by a signal. */ |
314 | 2062 |
2063 do_pending_window_change () | |
2064 { | |
2065 /* If window_change_signal should have run before, run it now. */ | |
2066 while (delayed_size_change) | |
2067 { | |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2068 Lisp_Object tail, frame; |
314 | 2069 |
2070 delayed_size_change = 0; | |
2071 | |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2072 FOR_EACH_FRAME (tail, frame) |
314 | 2073 { |
2252
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2074 FRAME_PTR f = XFRAME (frame); |
9793d8654e23
* frame.h (FOR_EACH_FRAME): Change the definition so that
Jim Blandy <jimb@redhat.com>
parents:
2198
diff
changeset
|
2075 |
764 | 2076 int height = FRAME_NEW_HEIGHT (f); |
2077 int width = FRAME_NEW_WIDTH (f); | |
314 | 2078 |
3449
ad455da9b789
(do_pending_window_change): No need to clear
Richard M. Stallman <rms@gnu.org>
parents:
3357
diff
changeset
|
2079 if (height != 0 || width != 0) |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2080 change_frame_size (f, height, width, 0, 0); |
314 | 2081 } |
2082 } | |
2083 } | |
2084 | |
2085 | |
764 | 2086 /* Change the frame height and/or width. Values may be given as zero to |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2087 indicate no change is to take place. |
314 | 2088 |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2089 If DELAY is non-zero, then assume we're being called from a signal |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2090 handler, and queue the change for later - perhaps the next |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2091 redisplay. Since this tries to resize windows, we can't call it |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2092 from a signal handler. */ |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2093 |
10770
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2094 change_frame_size (f, newheight, newwidth, pretend, delay) |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2095 register FRAME_PTR f; |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2096 int newheight, newwidth, pretend; |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2097 { |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2098 Lisp_Object tail, frame; |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2099 if (FRAME_TERMCAP_P (f)) |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2100 { |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2101 /* When using termcap, all frames use the same screen, |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2102 so a change in size affects all termcap frames. */ |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2103 FOR_EACH_FRAME (tail, frame) |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2104 if (FRAME_TERMCAP_P (XFRAME (frame))) |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2105 change_frame_size_1 (XFRAME (frame), newheight, newwidth, |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2106 pretend, delay); |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2107 } |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2108 else |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2109 change_frame_size_1 (f, newheight, newwidth, pretend, delay); |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2110 } |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2111 |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2112 static void |
79745e047484
(change_frame_size_1): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents:
10745
diff
changeset
|
2113 change_frame_size_1 (frame, newheight, newwidth, pretend, delay) |
764 | 2114 register FRAME_PTR frame; |
11914
b1a014bdd22c
(change_frame_size_1): Declare arg DELAY.
Karl Heuer <kwzh@gnu.org>
parents:
11858
diff
changeset
|
2115 int newheight, newwidth, pretend, delay; |
314 | 2116 { |
2117 /* If we can't deal with the change now, queue it for later. */ | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2118 if (delay) |
314 | 2119 { |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2120 FRAME_NEW_HEIGHT (frame) = newheight; |
764 | 2121 FRAME_NEW_WIDTH (frame) = newwidth; |
314 | 2122 delayed_size_change = 1; |
2123 return; | |
2124 } | |
2125 | |
764 | 2126 /* This size-change overrides any pending one for this frame. */ |
2127 FRAME_NEW_HEIGHT (frame) = 0; | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2128 FRAME_NEW_WIDTH (frame) = 0; |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2129 |
3449
ad455da9b789
(do_pending_window_change): No need to clear
Richard M. Stallman <rms@gnu.org>
parents:
3357
diff
changeset
|
2130 /* If an argument is zero, set it to the current value. */ |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2131 newheight || (newheight = FRAME_HEIGHT (frame)); |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2132 newwidth || (newwidth = FRAME_WIDTH (frame)); |
314 | 2133 |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2134 /* Round up to the smallest acceptable size. */ |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2135 check_frame_size (frame, &newheight, &newwidth); |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2136 |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2137 /* If we're not changing the frame size, quit now. */ |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2138 if (newheight == FRAME_HEIGHT (frame) |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2139 && newwidth == FRAME_WIDTH (frame)) |
314 | 2140 return; |
2141 | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2142 if (newheight != FRAME_HEIGHT (frame)) |
314 | 2143 { |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2144 if (FRAME_HAS_MINIBUF_P (frame) |
764 | 2145 && ! FRAME_MINIBUF_ONLY_P (frame)) |
314 | 2146 { |
764 | 2147 /* Frame has both root and minibuffer. */ |
2148 set_window_height (FRAME_ROOT_WINDOW (frame), | |
2132
0f4b18efebf5
(change_frame_size): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1915
diff
changeset
|
2149 newheight - 1 - FRAME_MENU_BAR_LINES (frame), 0); |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
2150 XSETFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (frame))->top, |
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
2151 newheight - 1); |
764 | 2152 set_window_height (FRAME_MINIBUF_WINDOW (frame), 1, 0); |
314 | 2153 } |
2154 else | |
764 | 2155 /* Frame has just one top-level window. */ |
2132
0f4b18efebf5
(change_frame_size): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1915
diff
changeset
|
2156 set_window_height (FRAME_ROOT_WINDOW (frame), |
0f4b18efebf5
(change_frame_size): Handle FRAME_MENU_BAR_LINES.
Richard M. Stallman <rms@gnu.org>
parents:
1915
diff
changeset
|
2157 newheight - FRAME_MENU_BAR_LINES (frame), 0); |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2158 |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2159 if (FRAME_TERMCAP_P (frame) && !pretend) |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2160 FrameRows = newheight; |
314 | 2161 |
2162 #if 0 | |
764 | 2163 if (frame->output_method == output_termcap) |
314 | 2164 { |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2165 frame_height = newheight; |
314 | 2166 if (!pretend) |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2167 FrameRows = newheight; |
314 | 2168 } |
2169 #endif | |
2170 } | |
2171 | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2172 if (newwidth != FRAME_WIDTH (frame)) |
314 | 2173 { |
764 | 2174 set_window_width (FRAME_ROOT_WINDOW (frame), newwidth, 0); |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2175 if (FRAME_HAS_MINIBUF_P (frame)) |
764 | 2176 set_window_width (FRAME_MINIBUF_WINDOW (frame), newwidth, 0); |
314 | 2177 |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2178 if (FRAME_TERMCAP_P (frame) && !pretend) |
764 | 2179 FrameCols = newwidth; |
314 | 2180 #if 0 |
764 | 2181 if (frame->output_method == output_termcap) |
314 | 2182 { |
764 | 2183 frame_width = newwidth; |
314 | 2184 if (!pretend) |
764 | 2185 FrameCols = newwidth; |
314 | 2186 } |
2187 #endif | |
2188 } | |
2189 | |
960
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2190 FRAME_HEIGHT (frame) = newheight; |
17986889d3b6
* dispnew.c (Fredraw_frame): Call clear_frame_records before
Jim Blandy <jimb@redhat.com>
parents:
764
diff
changeset
|
2191 FRAME_WIDTH (frame) = newwidth; |
7648
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2192 |
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2193 if (FRAME_CURSOR_X (frame) >= FRAME_WIDTH (frame)) |
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2194 FRAME_CURSOR_X (frame) = FRAME_WIDTH (frame) - 1; |
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2195 if (FRAME_CURSOR_Y (frame) >= FRAME_HEIGHT (frame)) |
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2196 FRAME_CURSOR_Y (frame) = FRAME_HEIGHT (frame) - 1; |
2e85e48d42da
(change_frame_size): Keep cursor coords in range.
Richard M. Stallman <rms@gnu.org>
parents:
7558
diff
changeset
|
2197 |
764 | 2198 remake_frame_glyphs (frame); |
2199 calculate_costs (frame); | |
314 | 2200 } |
2201 | |
2202 DEFUN ("send-string-to-terminal", Fsend_string_to_terminal, | |
2203 Ssend_string_to_terminal, 1, 1, 0, | |
2204 "Send STRING to the terminal without alteration.\n\ | |
2205 Control characters in STRING will have terminal-dependent effects.") | |
2206 (str) | |
2207 Lisp_Object str; | |
2208 { | |
2209 CHECK_STRING (str, 0); | |
2210 fwrite (XSTRING (str)->data, 1, XSTRING (str)->size, stdout); | |
2211 fflush (stdout); | |
2212 if (termscript) | |
2213 { | |
2214 fwrite (XSTRING (str)->data, 1, XSTRING (str)->size, termscript); | |
2215 fflush (termscript); | |
2216 } | |
2217 return Qnil; | |
2218 } | |
2219 | |
2220 DEFUN ("ding", Fding, Sding, 0, 1, 0, | |
2221 "Beep, or flash the screen.\n\ | |
2222 Also, unless an argument is given,\n\ | |
2223 terminate any keyboard macro currently executing.") | |
2224 (arg) | |
2225 Lisp_Object arg; | |
2226 { | |
493 | 2227 if (!NILP (arg)) |
314 | 2228 { |
649
61deba7b73b6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
587
diff
changeset
|
2229 if (noninteractive) |
61deba7b73b6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
587
diff
changeset
|
2230 putchar (07); |
61deba7b73b6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
587
diff
changeset
|
2231 else |
61deba7b73b6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
587
diff
changeset
|
2232 ring_bell (); |
314 | 2233 fflush (stdout); |
2234 } | |
2235 else | |
2236 bitch_at_user (); | |
2237 | |
2238 return Qnil; | |
2239 } | |
2240 | |
2241 bitch_at_user () | |
2242 { | |
2243 if (noninteractive) | |
2244 putchar (07); | |
2245 else if (!INTERACTIVE) /* Stop executing a keyboard macro. */ | |
2246 error ("Keyboard macro terminated by a command ringing the bell"); | |
2247 else | |
2248 ring_bell (); | |
2249 fflush (stdout); | |
2250 } | |
2251 | |
2252 DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, | |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2253 "Pause, without updating display, for SECONDS seconds.\n\ |
2648 | 2254 SECONDS may be a floating-point value, meaning that you can wait for a\n\ |
2255 fraction of a second. Optional second arg MILLISECONDS specifies an\n\ | |
2256 additional wait period, in milliseconds; this may be useful if your\n\ | |
2257 Emacs was built without floating point support.\n\ | |
2258 \(Not all operating systems support waiting for a fraction of a second.)") | |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2259 (seconds, milliseconds) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2260 Lisp_Object seconds, milliseconds; |
314 | 2261 { |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2262 int sec, usec; |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2263 |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2264 if (NILP (milliseconds)) |
9264
9338a124ea84
(redraw_frame, Fsleep_for, sit_for, Fsit_for): Use new accessor macros instead
Karl Heuer <kwzh@gnu.org>
parents:
8903
diff
changeset
|
2265 XSETINT (milliseconds, 0); |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2266 else |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2267 CHECK_NUMBER (milliseconds, 1); |
2648 | 2268 usec = XINT (milliseconds) * 1000; |
2269 | |
2270 #ifdef LISP_FLOAT_TYPE | |
2271 { | |
2272 double duration = extract_float (seconds); | |
2273 sec = (int) duration; | |
2274 usec += (duration - sec) * 1000000; | |
2275 } | |
2276 #else | |
2277 CHECK_NUMBER (seconds, 0); | |
2278 sec = XINT (seconds); | |
2279 #endif | |
314 | 2280 |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2281 #ifndef EMACS_HAS_USECS |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2282 if (sec == 0 && usec != 0) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2283 error ("millisecond `sleep-for' not supported on %s", SYSTEM_TYPE); |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2284 #endif |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2285 |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2286 /* Assure that 0 <= usec < 1000000. */ |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2287 if (usec < 0) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2288 { |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2289 /* We can't rely on the rounding being correct if user is negative. */ |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2290 if (-1000000 < usec) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2291 sec--, usec += 1000000; |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2292 else |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2293 sec -= -usec / 1000000, usec = 1000000 - (-usec % 1000000); |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2294 } |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2295 else |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2296 sec += usec / 1000000, usec %= 1000000; |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2297 |
4290
885452da2a8f
(Fsleep_for): If arg is 0, return right away.
Richard M. Stallman <rms@gnu.org>
parents:
4276
diff
changeset
|
2298 if (sec <= 0) |
314 | 2299 return Qnil; |
2300 | |
650 | 2301 { |
2302 Lisp_Object zero; | |
2303 | |
9303
3115ae493c30
(direct_output_for_insert, direct_output_forward_char, change_frame_size,
Karl Heuer <kwzh@gnu.org>
parents:
9264
diff
changeset
|
2304 XSETFASTINT (zero, 0); |
650 | 2305 wait_reading_process_input (sec, usec, zero, 0); |
2306 } | |
587 | 2307 |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2308 /* We should always have wait_reading_process_input; we have a dummy |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2309 implementation for systems which don't support subprocesses. */ |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2310 #if 0 |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2311 /* No wait_reading_process_input */ |
314 | 2312 immediate_quit = 1; |
2313 QUIT; | |
2314 | |
2315 #ifdef VMS | |
2316 sys_sleep (sec); | |
2317 #else /* not VMS */ | |
2318 /* The reason this is done this way | |
2319 (rather than defined (H_S) && defined (H_T)) | |
2320 is because the VMS preprocessor doesn't grok `defined' */ | |
2321 #ifdef HAVE_SELECT | |
554 | 2322 EMACS_GET_TIME (end_time); |
2323 EMACS_SET_SECS_USECS (timeout, sec, usec); | |
587 | 2324 EMACS_ADD_TIME (end_time, end_time, timeout); |
554 | 2325 |
314 | 2326 while (1) |
2327 { | |
554 | 2328 EMACS_GET_TIME (timeout); |
2329 EMACS_SUB_TIME (timeout, end_time, timeout); | |
2330 if (EMACS_TIME_NEG_P (timeout) | |
2331 || !select (1, 0, 0, 0, &timeout)) | |
314 | 2332 break; |
2333 } | |
2334 #else /* not HAVE_SELECT */ | |
2335 sleep (sec); | |
2336 #endif /* HAVE_SELECT */ | |
2337 #endif /* not VMS */ | |
2338 | |
2339 immediate_quit = 0; | |
2340 #endif /* no subprocesses */ | |
2341 | |
2342 return Qnil; | |
2343 } | |
2344 | |
650 | 2345 /* This is just like wait_reading_process_input, except that |
2346 it does the redisplay. | |
2347 | |
5223
db2e7e6a488e
(Fsit_for): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5218
diff
changeset
|
2348 It's also much like Fsit_for, except that it can be used for |
11411
91bcce2fd486
(Fframe_or_buffer_changed_p): Ignore buffers whose names start with space.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2349 waiting for input as well. */ |
650 | 2350 |
2351 Lisp_Object | |
2352 sit_for (sec, usec, reading, display) | |
2353 int sec, usec, reading, display; | |
314 | 2354 { |
650 | 2355 Lisp_Object read_kbd; |
314 | 2356 |
2357 if (detect_input_pending ()) | |
2358 return Qnil; | |
650 | 2359 |
2360 if (display) | |
314 | 2361 redisplay_preserve_echo_area (); |
2362 | |
673 | 2363 if (sec == 0 && usec == 0) |
2364 return Qt; | |
2365 | |
314 | 2366 #ifdef SIGIO |
1915
98ecf99d7b1a
* dispnew.c (sit_for): Pass the correct number of arguments to
Jim Blandy <jimb@redhat.com>
parents:
1872
diff
changeset
|
2367 gobble_input (0); |
650 | 2368 #endif |
2369 | |
9264
9338a124ea84
(redraw_frame, Fsleep_for, sit_for, Fsit_for): Use new accessor macros instead
Karl Heuer <kwzh@gnu.org>
parents:
8903
diff
changeset
|
2370 XSETINT (read_kbd, reading ? -1 : 1); |
650 | 2371 wait_reading_process_input (sec, usec, read_kbd, display); |
2372 | |
587 | 2373 |
2288
c6f3343edee1
Do * dispnew.c (sit_for): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2252
diff
changeset
|
2374 /* wait_reading_process_input should always be available now; it is |
c6f3343edee1
Do * dispnew.c (sit_for): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2252
diff
changeset
|
2375 simulated in a simple way on systems that don't support |
c6f3343edee1
Do * dispnew.c (sit_for): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2252
diff
changeset
|
2376 subprocesses. */ |
c6f3343edee1
Do * dispnew.c (sit_for): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2252
diff
changeset
|
2377 #if 0 |
c6f3343edee1
Do * dispnew.c (sit_for): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
2252
diff
changeset
|
2378 /* No wait_reading_process_input available. */ |
314 | 2379 immediate_quit = 1; |
2380 QUIT; | |
2381 | |
2382 waitchannels = 1; | |
2383 #ifdef VMS | |
650 | 2384 input_wait_timeout (XINT (arg)); |
314 | 2385 #else /* not VMS */ |
587 | 2386 #ifndef HAVE_TIMEVAL |
2387 timeout_sec = sec; | |
2388 select (1, &waitchannels, 0, 0, &timeout_sec); | |
2389 #else /* HAVE_TIMEVAL */ | |
2390 timeout.tv_sec = sec; | |
2391 timeout.tv_usec = usec; | |
314 | 2392 select (1, &waitchannels, 0, 0, &timeout); |
587 | 2393 #endif /* HAVE_TIMEVAL */ |
314 | 2394 #endif /* not VMS */ |
2395 | |
2396 immediate_quit = 0; | |
587 | 2397 #endif |
314 | 2398 |
2399 return detect_input_pending () ? Qnil : Qt; | |
2400 } | |
2401 | |
650 | 2402 DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2403 "Perform redisplay, then wait for SECONDS seconds or until input is available.\n\ |
2648 | 2404 SECONDS may be a floating-point value, meaning that you can wait for a\n\ |
2405 fraction of a second. Optional second arg MILLISECONDS specifies an\n\ | |
2406 additional wait period, in milliseconds; this may be useful if your\n\ | |
2407 Emacs was built without floating point support.\n\ | |
2408 \(Not all operating systems support waiting for a fraction of a second.)\n\ | |
650 | 2409 Optional third arg non-nil means don't redisplay, just wait for input.\n\ |
2410 Redisplay is preempted as always if input arrives, and does not happen\n\ | |
2411 if input is available before it starts.\n\ | |
2412 Value is t if waited the full time with no input arriving.") | |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2413 (seconds, milliseconds, nodisp) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2414 Lisp_Object seconds, milliseconds, nodisp; |
650 | 2415 { |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2416 int sec, usec; |
650 | 2417 |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2418 if (NILP (milliseconds)) |
9264
9338a124ea84
(redraw_frame, Fsleep_for, sit_for, Fsit_for): Use new accessor macros instead
Karl Heuer <kwzh@gnu.org>
parents:
8903
diff
changeset
|
2419 XSETINT (milliseconds, 0); |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2420 else |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2421 CHECK_NUMBER (milliseconds, 1); |
2648 | 2422 usec = XINT (milliseconds) * 1000; |
2423 | |
2424 #ifdef LISP_FLOAT_TYPE | |
2425 { | |
2426 double duration = extract_float (seconds); | |
2427 sec = (int) duration; | |
2428 usec += (duration - sec) * 1000000; | |
2429 } | |
2430 #else | |
2431 CHECK_NUMBER (seconds, 0); | |
2432 sec = XINT (seconds); | |
2433 #endif | |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2434 |
650 | 2435 #ifndef EMACS_HAS_USECS |
2291
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2436 if (usec != 0 && sec == 0) |
bee5c1693cac
* dispnew.c (Fsleep_for): Make this take two arguments SECONDS and
Jim Blandy <jimb@redhat.com>
parents:
2288
diff
changeset
|
2437 error ("millisecond `sit-for' not supported on %s", SYSTEM_TYPE); |
650 | 2438 #endif |
2439 | |
2440 return sit_for (sec, usec, 0, NILP (nodisp)); | |
2441 } | |
314 | 2442 |
2443 char *terminal_type; | |
2444 | |
2445 /* Initialization done when Emacs fork is started, before doing stty. */ | |
2446 /* Determine terminal type and set terminal_driver */ | |
2447 /* Then invoke its decoding routine to set up variables | |
2448 in the terminal package */ | |
2449 | |
2450 init_display () | |
2451 { | |
2452 #ifdef HAVE_X_WINDOWS | |
2453 extern int display_arg; | |
2454 #endif | |
2455 | |
2456 meta_key = 0; | |
2457 inverse_video = 0; | |
2458 cursor_in_echo_area = 0; | |
2459 terminal_type = (char *) 0; | |
2460 | |
2339
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2461 /* Now is the time to initialize this; it's used by init_sys_modes |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2462 during startup. */ |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2463 Vwindow_system = Qnil; |
314 | 2464 |
2339
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2465 /* If the user wants to use a window system, we shouldn't bother |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2466 initializing the terminal. This is especially important when the |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2467 terminal is so dumb that emacs gives up before and doesn't bother |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2468 using the window system. |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2469 |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2470 If the DISPLAY environment variable is set, try to use X, and die |
a302de11debf
* dispnew.c (init_display): Initialize Vwindow_system.
Jim Blandy <jimb@redhat.com>
parents:
2292
diff
changeset
|
2471 with an error message if that doesn't work. */ |
314 | 2472 |
2473 #ifdef HAVE_X_WINDOWS | |
2359
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2474 if (! display_arg) |
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2475 { |
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2476 #ifdef VMS |
2511
4fc5338ebb8f
* dispnew.c (getenv): Extern declaration deleted; this is done in
Jim Blandy <jimb@redhat.com>
parents:
2439
diff
changeset
|
2477 display_arg = (getenv ("DECW$DISPLAY") != 0); |
2359
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2478 #else |
2511
4fc5338ebb8f
* dispnew.c (getenv): Extern declaration deleted; this is done in
Jim Blandy <jimb@redhat.com>
parents:
2439
diff
changeset
|
2479 display_arg = (getenv ("DISPLAY") != 0); |
2359
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2480 #endif |
2364 | 2481 } |
2359
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2482 |
90a5f91329f3
* dispnew.c (init_display): Get display name from environment
Jim Blandy <jimb@redhat.com>
parents:
2339
diff
changeset
|
2483 if (!inhibit_window_system && display_arg) |
314 | 2484 { |
2485 Vwindow_system = intern ("x"); | |
2486 #ifdef HAVE_X11 | |
2487 Vwindow_system_version = make_number (11); | |
2488 #else | |
2489 Vwindow_system_version = make_number (10); | |
2490 #endif | |
2491 return; | |
2492 } | |
2493 #endif /* HAVE_X_WINDOWS */ | |
2494 | |
2495 /* If no window system has been specified, try to use the terminal. */ | |
2496 if (! isatty (0)) | |
2497 { | |
2498 fprintf (stderr, "emacs: standard input is not a tty\n"); | |
2499 exit (1); | |
2500 } | |
2501 | |
2502 /* Look at the TERM variable */ | |
2503 terminal_type = (char *) getenv ("TERM"); | |
2504 if (!terminal_type) | |
2505 { | |
2506 #ifdef VMS | |
2507 fprintf (stderr, "Please specify your terminal type.\n\ | |
2508 For types defined in VMS, use set term /device=TYPE.\n\ | |
2509 For types not defined in VMS, use define emacs_term \"TYPE\".\n\ | |
2510 \(The quotation marks are necessary since terminal types are lower case.)\n"); | |
2511 #else | |
2512 fprintf (stderr, "Please set the environment variable TERM; see tset(1).\n"); | |
2513 #endif | |
2514 exit (1); | |
2515 } | |
2516 | |
2517 #ifdef VMS | |
2518 /* VMS DCL tends to upcase things, so downcase term type. | |
2519 Hardly any uppercase letters in terminal types; should be none. */ | |
2520 { | |
2521 char *new = (char *) xmalloc (strlen (terminal_type) + 1); | |
2522 char *p; | |
2523 | |
2524 strcpy (new, terminal_type); | |
2525 | |
2526 for (p = new; *p; p++) | |
2527 if (isupper (*p)) | |
2528 *p = tolower (*p); | |
2529 | |
2530 terminal_type = new; | |
2531 } | |
2532 #endif | |
2533 | |
2534 term_init (terminal_type); | |
2535 | |
764 | 2536 remake_frame_glyphs (selected_frame); |
2537 calculate_costs (selected_frame); | |
314 | 2538 |
2539 /* X and Y coordinates of the cursor between updates. */ | |
764 | 2540 FRAME_CURSOR_X (selected_frame) = 0; |
2541 FRAME_CURSOR_Y (selected_frame) = 0; | |
314 | 2542 |
2543 #ifdef SIGWINCH | |
2544 #ifndef CANNOT_DUMP | |
2545 if (initialized) | |
2546 #endif /* CANNOT_DUMP */ | |
2547 signal (SIGWINCH, window_change_signal); | |
2548 #endif /* SIGWINCH */ | |
2549 } | |
2550 | |
2551 syms_of_display () | |
2552 { | |
764 | 2553 #ifdef MULTI_FRAME |
2554 defsubr (&Sredraw_frame); | |
314 | 2555 #endif |
2556 defsubr (&Sredraw_display); | |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2557 defsubr (&Sframe_or_buffer_changed_p); |
314 | 2558 defsubr (&Sopen_termscript); |
2559 defsubr (&Sding); | |
2560 defsubr (&Ssit_for); | |
2561 defsubr (&Ssleep_for); | |
2562 defsubr (&Ssend_string_to_terminal); | |
2563 | |
12186
6811992e871c
(Fframe_or_buffer_changed_p): Calculate vector size right.
Karl Heuer <kwzh@gnu.org>
parents:
11919
diff
changeset
|
2564 frame_and_buffer_state = Fmake_vector (make_number (20), Qlambda); |
7810
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2565 staticpro (&frame_and_buffer_state); |
15c0bf73737e
(Fframe_or_buffer_changed_p): New function.
Karl Heuer <kwzh@gnu.org>
parents:
7808
diff
changeset
|
2566 |
13220
2e9014617492
(Qdisplay_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13105
diff
changeset
|
2567 Qdisplay_table = intern ("display-table"); |
2e9014617492
(Qdisplay_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13105
diff
changeset
|
2568 staticpro (&Qdisplay_table); |
2e9014617492
(Qdisplay_table): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13105
diff
changeset
|
2569 |
314 | 2570 DEFVAR_INT ("baud-rate", &baud_rate, |
7926
b87f2c705501
(syms_of_display): Make baud-rate a user var.
Richard M. Stallman <rms@gnu.org>
parents:
7900
diff
changeset
|
2571 "*The output baud rate of the terminal.\n\ |
314 | 2572 On most systems, changing this value will affect the amount of padding\n\ |
2573 and the other strategic decisions made during redisplay."); | |
2574 DEFVAR_BOOL ("inverse-video", &inverse_video, | |
764 | 2575 "*Non-nil means invert the entire frame display.\n\ |
314 | 2576 This means everything is in inverse video which otherwise would not be."); |
2577 DEFVAR_BOOL ("visible-bell", &visible_bell, | |
764 | 2578 "*Non-nil means try to flash the frame to represent a bell."); |
314 | 2579 DEFVAR_BOOL ("no-redraw-on-reenter", &no_redraw_on_reenter, |
764 | 2580 "*Non-nil means no need to redraw entire frame after suspending.\n\ |
314 | 2581 A non-nil value is useful if the terminal can automatically preserve\n\ |
764 | 2582 Emacs's frame display when you reenter Emacs.\n\ |
314 | 2583 It is up to you to set this variable if your terminal can do that."); |
2584 DEFVAR_LISP ("window-system", &Vwindow_system, | |
2585 "A symbol naming the window-system under which Emacs is running\n\ | |
2586 \(such as `x'), or nil if emacs is running on an ordinary terminal."); | |
2587 DEFVAR_LISP ("window-system-version", &Vwindow_system_version, | |
2588 "The version number of the window system in use.\n\ | |
2589 For X windows, this is 10 or 11."); | |
2590 DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area, | |
2591 "Non-nil means put cursor in minibuffer, at end of any message there."); | |
2592 DEFVAR_LISP ("glyph-table", &Vglyph_table, | |
764 | 2593 "Table defining how to output a glyph code to the frame.\n\ |
314 | 2594 If not nil, this is a vector indexed by glyph code to define the glyph.\n\ |
2595 Each element can be:\n\ | |
2596 integer: a glyph code which this glyph is an alias for.\n\ | |
2597 string: output this glyph using that string (not impl. in X windows).\n\ | |
2598 nil: this glyph mod 256 is char code to output,\n\ | |
6857 | 2599 and this glyph / 256 is face code for X windows (see `face-id')."); |
314 | 2600 Vglyph_table = Qnil; |
2601 | |
2602 DEFVAR_LISP ("standard-display-table", &Vstandard_display_table, | |
2603 "Display table to use for buffers that specify none.\n\ | |
2604 See `buffer-display-table' for more information."); | |
2605 Vstandard_display_table = Qnil; | |
2606 | |
2607 /* Initialize `window-system', unless init_display already decided it. */ | |
2608 #ifdef CANNOT_DUMP | |
2609 if (noninteractive) | |
2610 #endif | |
2611 { | |
2612 Vwindow_system = Qnil; | |
2613 Vwindow_system_version = Qnil; | |
2614 } | |
2615 } |