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