]> code.delx.au - gnu-emacs/blob - src/fringe.c
Merged in changes from CVS HEAD
[gnu-emacs] / src / fringe.c
1 /* Fringe handling (split from xdisp.c).
2 Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04
3 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #include <config.h>
23 #include <stdio.h>
24
25 #include "lisp.h"
26 #include "frame.h"
27 #include "window.h"
28 #include "dispextern.h"
29 #include "buffer.h"
30 #include "blockinput.h"
31 #include "termhooks.h"
32
33 #ifdef HAVE_WINDOW_SYSTEM
34
35 extern Lisp_Object Qtop, Qbottom, Qcenter;
36
37 /* Non-nil means that newline may flow into the right fringe. */
38
39 Lisp_Object Voverflow_newline_into_fringe;
40
41
42 enum fringe_bitmap_type
43 {
44 NO_FRINGE_BITMAP = 0,
45 UNDEF_FRINGE_BITMAP,
46 LEFT_TRUNCATION_BITMAP,
47 RIGHT_TRUNCATION_BITMAP,
48 UP_ARROW_BITMAP,
49 DOWN_ARROW_BITMAP,
50 CONTINUED_LINE_BITMAP,
51 CONTINUATION_LINE_BITMAP,
52 OVERLAY_ARROW_BITMAP,
53 TOP_LEFT_ANGLE_BITMAP,
54 TOP_RIGHT_ANGLE_BITMAP,
55 BOTTOM_LEFT_ANGLE_BITMAP,
56 BOTTOM_RIGHT_ANGLE_BITMAP,
57 LEFT_BRACKET_BITMAP,
58 RIGHT_BRACKET_BITMAP,
59 FILLED_BOX_CURSOR_BITMAP,
60 HOLLOW_BOX_CURSOR_BITMAP,
61 HOLLOW_SQUARE_BITMAP,
62 BAR_CURSOR_BITMAP,
63 HBAR_CURSOR_BITMAP,
64 ZV_LINE_BITMAP,
65 MAX_STANDARD_FRINGE_BITMAPS
66 };
67
68 enum fringe_bitmap_align
69 {
70 ALIGN_BITMAP_CENTER = 0,
71 ALIGN_BITMAP_TOP,
72 ALIGN_BITMAP_BOTTOM
73 };
74
75 struct fringe_bitmap
76 {
77 unsigned short *bits;
78 unsigned height : 8;
79 unsigned width : 8;
80 unsigned period : 8;
81 unsigned align : 2;
82 unsigned dynamic : 1;
83 };
84
85 \f
86 /***********************************************************************
87 Fringe bitmaps
88 ***********************************************************************/
89
90 /* Undefined bitmap. A question mark. */
91 /*
92 ..xxxx..
93 .xxxxxx.
94 xx....xx
95 xx....xx
96 ....xx..
97 ...xx...
98 ...xx...
99 ........
100 ...xx...
101 ...xx...
102 */
103 static unsigned short unknown_bits[] = {
104 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18};
105
106 /* An arrow like this: `<-'. */
107 /*
108 ...xx...
109 ..xx....
110 .xx.....
111 xxxxxx..
112 xxxxxx..
113 .xx.....
114 ..xx....
115 ...xx...
116 */
117 static unsigned short left_arrow_bits[] = {
118 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
119
120
121 /* Right truncation arrow bitmap `->'. */
122 /*
123 ...xx...
124 ....xx..
125 .....xx.
126 ..xxxxxx
127 ..xxxxxx
128 .....xx.
129 ....xx..
130 ...xx...
131 */
132 static unsigned short right_arrow_bits[] = {
133 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
134
135
136 /* Up arrow bitmap. */
137 /*
138 ...xx...
139 ..xxxx..
140 .xxxxxx.
141 xxxxxxxx
142 ...xx...
143 ...xx...
144 ...xx...
145 ...xx...
146 */
147 static unsigned short up_arrow_bits[] = {
148 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18};
149
150
151 /* Down arrow bitmap. */
152 /*
153 ...xx...
154 ...xx...
155 ...xx...
156 ...xx...
157 xxxxxxxx
158 .xxxxxx.
159 ..xxxx..
160 ...xx...
161 */
162 static unsigned short down_arrow_bits[] = {
163 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18};
164
165 /* Marker for continued lines. */
166 /*
167 ..xxxx..
168 ..xxxxx.
169 ......xx
170 ..x..xxx
171 ..xxxxxx
172 ..xxxxx.
173 ..xxxx..
174 ..xxxxx.
175 */
176 static unsigned short continued_bits[] = {
177 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
178
179 /* Marker for continuation lines. */
180 /*
181 ..xxxx..
182 .xxxxx..
183 xx......
184 xxx..x..
185 xxxxxx..
186 .xxxxx..
187 ..xxxx..
188 .xxxxx..
189 */
190 static unsigned short continuation_bits[] = {
191 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
192
193 /* Overlay arrow bitmap. A triangular arrow. */
194 /*
195 xx......
196 xxxx....
197 xxxxx...
198 xxxxxx..
199 xxxxxx..
200 xxxxx...
201 xxxx....
202 xx......
203 */
204 static unsigned short ov_bits[] = {
205 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0};
206
207 #if 0
208 /* Reverse Overlay arrow bitmap. A triangular arrow. */
209 /*
210 ......xx
211 ....xxxx
212 ...xxxxx
213 ..xxxxxx
214 ..xxxxxx
215 ...xxxxx
216 ....xxxx
217 ......xx
218 */
219 static unsigned short rev_ov_bits[] = {
220 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03};
221 #endif
222
223 /* First line bitmap. An top-left angle. */
224 /*
225 xxxxxx..
226 xxxxxx..
227 xx......
228 xx......
229 xx......
230 xx......
231 xx......
232 ........
233 */
234 static unsigned short top_left_angle_bits[] = {
235 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00};
236
237 /* First line bitmap. An right-up angle. */
238 /*
239 ..xxxxxx
240 ..xxxxxx
241 ......xx
242 ......xx
243 ......xx
244 ......xx
245 ......xx
246 ........
247 */
248 static unsigned short top_right_angle_bits[] = {
249 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00};
250
251 /* Last line bitmap. An left-down angle. */
252 /*
253 ........
254 xx......
255 xx......
256 xx......
257 xx......
258 xx......
259 xxxxxx..
260 xxxxxx..
261 */
262 static unsigned short bottom_left_angle_bits[] = {
263 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
264
265 /* Last line bitmap. An right-down angle. */
266 /*
267 ........
268 ......xx
269 ......xx
270 ......xx
271 ......xx
272 ......xx
273 ..xxxxxx
274 ..xxxxxx
275 */
276 static unsigned short bottom_right_angle_bits[] = {
277 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f};
278
279 /* First/last line bitmap. An left bracket. */
280 /*
281 xxxxxx..
282 xxxxxx..
283 xx......
284 xx......
285 xx......
286 xx......
287 xx......
288 xx......
289 xxxxxx..
290 xxxxxx..
291 */
292 static unsigned short left_bracket_bits[] = {
293 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
294
295 /* First/last line bitmap. An right bracket. */
296 /*
297 ..xxxxxx
298 ..xxxxxx
299 ......xx
300 ......xx
301 ......xx
302 ......xx
303 ......xx
304 ......xx
305 ..xxxxxx
306 ..xxxxxx
307 */
308 static unsigned short right_bracket_bits[] = {
309 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f};
310
311 /* Filled box cursor bitmap. A filled box; max 13 pixels high. */
312 /*
313 xxxxxxx.
314 xxxxxxx.
315 xxxxxxx.
316 xxxxxxx.
317 xxxxxxx.
318 xxxxxxx.
319 xxxxxxx.
320 xxxxxxx.
321 xxxxxxx.
322 xxxxxxx.
323 xxxxxxx.
324 xxxxxxx.
325 xxxxxxx.
326 */
327 static unsigned short filled_box_cursor_bits[] = {
328 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
329
330 /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */
331 /*
332 xxxxxxx.
333 x.....x.
334 x.....x.
335 x.....x.
336 x.....x.
337 x.....x.
338 x.....x.
339 x.....x.
340 x.....x.
341 x.....x.
342 x.....x.
343 x.....x.
344 xxxxxxx.
345 */
346 static unsigned short hollow_box_cursor_bits[] = {
347 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe};
348
349 /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */
350 /*
351 xx......
352 xx......
353 xx......
354 xx......
355 xx......
356 xx......
357 xx......
358 xx......
359 xx......
360 xx......
361 xx......
362 xx......
363 xx......
364 */
365 static unsigned short bar_cursor_bits[] = {
366 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0};
367
368 /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */
369 /*
370 xxxxxxx.
371 xxxxxxx.
372 */
373 static unsigned short hbar_cursor_bits[] = {
374 0xfe, 0xfe};
375
376
377 /* Bitmap drawn to indicate lines not displaying text if
378 `indicate-empty-lines' is non-nil. */
379 /*
380 ........
381 ..xxxx..
382 ........
383 ........
384 ..xxxx..
385 ........
386 */
387 static unsigned short zv_bits[] = {
388 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
389 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
390 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
391 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
392 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
393 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
394 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
395 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00};
396
397 /* Hollow square bitmap. */
398 /*
399 .xxxxxx.
400 .x....x.
401 .x....x.
402 .x....x.
403 .x....x.
404 .xxxxxx.
405 */
406 static unsigned short hollow_square_bits[] = {
407 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e};
408
409
410 #define BYTES_PER_BITMAP_ROW (sizeof (unsigned short))
411 #define STANDARD_BITMAP_HEIGHT(bits) (sizeof (bits)/BYTES_PER_BITMAP_ROW)
412 #define FRBITS(bits) bits, STANDARD_BITMAP_HEIGHT (bits)
413
414 struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
415 {
416 { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */
417 { FRBITS (unknown_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
418 { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
419 { FRBITS (right_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
420 { FRBITS (up_arrow_bits), 8, 0, ALIGN_BITMAP_TOP, 0 },
421 { FRBITS (down_arrow_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 },
422 { FRBITS (continued_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
423 { FRBITS (continuation_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
424 { FRBITS (ov_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
425 { FRBITS (top_left_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 },
426 { FRBITS (top_right_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 },
427 { FRBITS (bottom_left_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 },
428 { FRBITS (bottom_right_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 },
429 { FRBITS (left_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
430 { FRBITS (right_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
431 { FRBITS (filled_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
432 { FRBITS (hollow_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
433 { FRBITS (hollow_square_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
434 { FRBITS (bar_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
435 { FRBITS (hbar_cursor_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 },
436 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 },
437 };
438
439 static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS];
440 static unsigned fringe_faces[MAX_FRINGE_BITMAPS];
441
442 static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
443
444 /* Return 1 if FRINGE_ID is a valid fringe bitmap id. */
445
446 int
447 valid_fringe_bitmap_id_p (fringe_id)
448 int fringe_id;
449 {
450 return (fringe_id >= NO_FRINGE_BITMAP
451 && fringe_id < max_used_fringe_bitmap
452 && (fringe_id < MAX_STANDARD_FRINGE_BITMAPS
453 || fringe_bitmaps[fringe_id] != NULL));
454 }
455
456 /* Draw the bitmap WHICH in one of the left or right fringes of
457 window W. ROW is the glyph row for which to display the bitmap; it
458 determines the vertical position at which the bitmap has to be
459 drawn.
460 LEFT_P is 1 for left fringe, 0 for right fringe.
461 */
462
463 void
464 draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
465 struct window *w;
466 struct glyph_row *row;
467 int left_p, overlay;
468 enum fringe_bitmap_type which;
469 {
470 struct frame *f = XFRAME (WINDOW_FRAME (w));
471 struct draw_fringe_bitmap_params p;
472 struct fringe_bitmap *fb;
473 int period;
474 int face_id = DEFAULT_FACE_ID;
475
476 p.cursor_p = 0;
477 p.overlay_p = (overlay & 1) == 1;
478 p.cursor_p = (overlay & 2) == 2;
479
480 if (which != NO_FRINGE_BITMAP)
481 {
482 }
483 else if (left_p)
484 {
485 which = row->left_fringe_bitmap;
486 face_id = row->left_fringe_face_id;
487 }
488 else
489 {
490 which = row->right_fringe_bitmap;
491 face_id = row->right_fringe_face_id;
492 }
493
494 if (face_id == DEFAULT_FACE_ID)
495 face_id = fringe_faces[which];
496
497 fb = fringe_bitmaps[which];
498 if (fb == NULL)
499 fb = &standard_bitmaps[which < MAX_STANDARD_FRINGE_BITMAPS
500 ? which : UNDEF_FRINGE_BITMAP];
501
502 period = fb->period;
503
504 /* Convert row to frame coordinates. */
505 p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
506
507 p.which = which;
508 p.bits = fb->bits;
509 p.wd = fb->width;
510
511 p.h = fb->height;
512 p.dh = (period > 0 ? (p.y % period) : 0);
513 p.h -= p.dh;
514 /* Clip bitmap if too high. */
515 if (p.h > row->height)
516 p.h = row->height;
517
518 p.face = FACE_FROM_ID (f, face_id);
519
520 if (p.face == NULL)
521 {
522 /* Why does this happen? ++kfs */
523 return;
524 }
525
526 PREPARE_FACE_FOR_DISPLAY (f, p.face);
527
528 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill
529 the fringe. */
530 p.bx = -1;
531 if (left_p)
532 {
533 int wd = WINDOW_LEFT_FRINGE_WIDTH (w);
534 int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
535 ? LEFT_MARGIN_AREA
536 : TEXT_AREA));
537 if (p.wd > wd)
538 p.wd = wd;
539 p.x = x - p.wd - (wd - p.wd) / 2;
540
541 if (p.wd < wd || row->height > p.h)
542 {
543 /* If W has a vertical border to its left, don't draw over it. */
544 wd -= ((!WINDOW_LEFTMOST_P (w)
545 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
546 ? 1 : 0);
547 p.bx = x - wd;
548 p.nx = wd;
549 }
550 }
551 else
552 {
553 int x = window_box_right (w,
554 (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
555 ? RIGHT_MARGIN_AREA
556 : TEXT_AREA));
557 int wd = WINDOW_RIGHT_FRINGE_WIDTH (w);
558 if (p.wd > wd)
559 p.wd = wd;
560 p.x = x + (wd - p.wd) / 2;
561 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill
562 the fringe. */
563 if (p.wd < wd || row->height > p.h)
564 {
565 p.bx = x;
566 p.nx = wd;
567 }
568 }
569
570 if (p.bx >= 0)
571 {
572 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
573
574 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
575 p.ny = row->visible_height;
576 }
577
578 /* Adjust y to the offset in the row to start drawing the bitmap. */
579 switch (fb->align)
580 {
581 case ALIGN_BITMAP_CENTER:
582 p.y += (row->height - p.h) / 2;
583 break;
584 case ALIGN_BITMAP_BOTTOM:
585 p.h = fb->height;
586 p.y += (row->visible_height - p.h);
587 break;
588 case ALIGN_BITMAP_TOP:
589 break;
590 }
591
592 FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
593 }
594
595 void
596 draw_fringe_bitmap (w, row, left_p)
597 struct window *w;
598 struct glyph_row *row;
599 int left_p;
600 {
601 int overlay = 0;
602
603 if (!left_p && row->cursor_in_fringe_p)
604 {
605 int cursor = NO_FRINGE_BITMAP;
606
607 switch (w->phys_cursor_type)
608 {
609 case HOLLOW_BOX_CURSOR:
610 if (row->visible_height >= STANDARD_BITMAP_HEIGHT (hollow_box_cursor_bits))
611 cursor = HOLLOW_BOX_CURSOR_BITMAP;
612 else
613 cursor = HOLLOW_SQUARE_BITMAP;
614 break;
615 case FILLED_BOX_CURSOR:
616 cursor = FILLED_BOX_CURSOR_BITMAP;
617 break;
618 case BAR_CURSOR:
619 cursor = BAR_CURSOR_BITMAP;
620 break;
621 case HBAR_CURSOR:
622 cursor = HBAR_CURSOR_BITMAP;
623 break;
624 case NO_CURSOR:
625 default:
626 w->phys_cursor_on_p = 0;
627 row->cursor_in_fringe_p = 0;
628 break;
629 }
630 if (cursor != NO_FRINGE_BITMAP)
631 {
632 draw_fringe_bitmap_1 (w, row, 0, 2, cursor);
633 overlay = cursor == FILLED_BOX_CURSOR_BITMAP ? 3 : 1;
634 }
635 }
636
637 draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP);
638
639 if (left_p && row->overlay_arrow_p)
640 draw_fringe_bitmap_1 (w, row, 1, 1, OVERLAY_ARROW_BITMAP);
641 }
642
643
644 /* Draw fringe bitmaps for glyph row ROW on window W. Call this
645 function with input blocked. */
646
647 void
648 draw_row_fringe_bitmaps (w, row)
649 struct window *w;
650 struct glyph_row *row;
651 {
652 xassert (interrupt_input_blocked);
653
654 /* If row is completely invisible, because of vscrolling, we
655 don't have to draw anything. */
656 if (row->visible_height <= 0)
657 return;
658
659 if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0)
660 draw_fringe_bitmap (w, row, 1);
661
662 if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0)
663 draw_fringe_bitmap (w, row, 0);
664 }
665
666 /* Draw the fringes of window W. Only fringes for rows marked for
667 update in redraw_fringe_bitmaps_p are drawn. */
668
669 void
670 draw_window_fringes (w)
671 struct window *w;
672 {
673 struct glyph_row *row;
674 int yb = window_text_bottom_y (w);
675 int nrows = w->current_matrix->nrows;
676 int y = 0, rn;
677
678 if (w->pseudo_window_p)
679 return;
680
681 for (y = 0, rn = 0, row = w->current_matrix->rows;
682 y < yb && rn < nrows;
683 y += row->height, ++row, ++rn)
684 {
685 if (!row->redraw_fringe_bitmaps_p)
686 continue;
687 draw_row_fringe_bitmaps (w, row);
688 row->redraw_fringe_bitmaps_p = 0;
689 }
690 }
691
692
693 /* Recalculate the bitmaps to show in the fringes of window W.
694 If FORCE_P is 0, only mark rows with modified bitmaps for update in
695 redraw_fringe_bitmaps_p; else mark all rows for update. */
696
697 int
698 update_window_fringes (w, force_p)
699 struct window *w;
700 int force_p;
701 {
702 struct glyph_row *row, *cur = 0;
703 int yb = window_text_bottom_y (w);
704 int rn, nrows = w->current_matrix->nrows;
705 int y;
706 int redraw_p = 0;
707 Lisp_Object ind;
708 int boundary_pos = 0, arrow_pos = 0;
709 int empty_pos = 0;
710
711 if (w->pseudo_window_p)
712 return 0;
713
714 if (!MINI_WINDOW_P (w)
715 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
716 {
717 int do_eob = 1, do_bob = 1;
718 Lisp_Object arrows;
719
720 if (CONSP (ind))
721 arrows = XCDR (ind), ind = XCAR (ind);
722 else
723 arrows = ind;
724
725 if (EQ (ind, Qleft))
726 boundary_pos = -1;
727 else if (EQ (ind, Qright))
728 boundary_pos = 1;
729
730 if (EQ (arrows, Qleft))
731 arrow_pos = -1;
732 else if (EQ (arrows, Qright))
733 arrow_pos = 1;
734
735 for (y = 0, rn = 0;
736 y < yb && rn < nrows;
737 y += row->height, ++rn)
738 {
739 unsigned indicate_bob_p, indicate_top_line_p;
740 unsigned indicate_eob_p, indicate_bottom_line_p;
741
742 row = w->desired_matrix->rows + rn;
743 if (!row->enabled_p)
744 row = w->current_matrix->rows + rn;
745
746 indicate_bob_p = row->indicate_bob_p;
747 indicate_top_line_p = row->indicate_top_line_p;
748 indicate_eob_p = row->indicate_eob_p;
749 indicate_bottom_line_p = row->indicate_bottom_line_p;
750
751 row->indicate_bob_p = row->indicate_top_line_p = 0;
752 row->indicate_eob_p = row->indicate_bottom_line_p = 0;
753
754 if (!NILP (ind)
755 && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
756 row->indicate_bob_p = do_bob, do_bob = 0;
757 else if (!NILP (arrows)
758 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
759 row->indicate_top_line_p = 1;
760
761 if (!NILP (ind)
762 && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
763 row->indicate_eob_p = do_eob, do_eob = 0;
764 else if (!NILP (arrows)
765 && y + row->height >= yb)
766 row->indicate_bottom_line_p = 1;
767
768 if (indicate_bob_p != row->indicate_bob_p
769 || indicate_top_line_p != row->indicate_top_line_p
770 || indicate_eob_p != row->indicate_eob_p
771 || indicate_bottom_line_p != row->indicate_bottom_line_p)
772 row->redraw_fringe_bitmaps_p = 1;
773 }
774 }
775
776 if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qright))
777 empty_pos = 1;
778 else if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qleft))
779 empty_pos = -1;
780
781 for (y = 0, rn = 0;
782 y < yb && rn < nrows;
783 y += row->height, rn++)
784 {
785 enum fringe_bitmap_type left, right;
786 unsigned left_face_id, right_face_id;
787
788 row = w->desired_matrix->rows + rn;
789 cur = w->current_matrix->rows + rn;
790 if (!row->enabled_p)
791 row = cur;
792
793 left_face_id = right_face_id = DEFAULT_FACE_ID;
794
795 /* Decide which bitmap to draw in the left fringe. */
796 if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
797 left = NO_FRINGE_BITMAP;
798 else if (row->left_user_fringe_bitmap != NO_FRINGE_BITMAP)
799 {
800 left = row->left_user_fringe_bitmap;
801 left_face_id = row->left_user_fringe_face_id;
802 }
803 #if 0 /* this is now done via an overlay */
804 else if (row->overlay_arrow_p)
805 left = OVERLAY_ARROW_BITMAP;
806 #endif
807 else if (row->indicate_bob_p && boundary_pos <= 0)
808 left = ((row->indicate_eob_p && boundary_pos < 0)
809 ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
810 else if (row->indicate_eob_p && boundary_pos < 0)
811 left = BOTTOM_LEFT_ANGLE_BITMAP;
812 else if (row->truncated_on_left_p)
813 left = LEFT_TRUNCATION_BITMAP;
814 else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
815 left = CONTINUATION_LINE_BITMAP;
816 else if (row->indicate_empty_line_p && empty_pos <= 0)
817 left = ZV_LINE_BITMAP;
818 else if (row->indicate_top_line_p && arrow_pos <= 0)
819 left = UP_ARROW_BITMAP;
820 else if (row->indicate_bottom_line_p && arrow_pos < 0)
821 left = DOWN_ARROW_BITMAP;
822 else
823 left = NO_FRINGE_BITMAP;
824
825 /* Decide which bitmap to draw in the right fringe. */
826 if (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)
827 right = NO_FRINGE_BITMAP;
828 else if (row->right_user_fringe_bitmap != NO_FRINGE_BITMAP)
829 {
830 right = row->right_user_fringe_bitmap;
831 right_face_id = row->right_user_fringe_face_id;
832 }
833 else if (row->indicate_bob_p && boundary_pos > 0)
834 right = ((row->indicate_eob_p && boundary_pos >= 0)
835 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
836 else if (row->indicate_eob_p && boundary_pos >= 0)
837 right = BOTTOM_RIGHT_ANGLE_BITMAP;
838 else if (row->truncated_on_right_p)
839 right = RIGHT_TRUNCATION_BITMAP;
840 else if (row->continued_p)
841 right = CONTINUED_LINE_BITMAP;
842 else if (row->indicate_top_line_p && arrow_pos > 0)
843 right = UP_ARROW_BITMAP;
844 else if (row->indicate_bottom_line_p && arrow_pos >= 0)
845 right = DOWN_ARROW_BITMAP;
846 else if (row->indicate_empty_line_p
847 && (empty_pos > 0
848 || (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 && empty_pos == 0)))
849 right = ZV_LINE_BITMAP;
850 else
851 right = NO_FRINGE_BITMAP;
852
853 if (force_p
854 || row->y != cur->y
855 || row->visible_height != cur->visible_height
856 || left != cur->left_fringe_bitmap
857 || right != cur->right_fringe_bitmap
858 || left_face_id != cur->left_fringe_face_id
859 || right_face_id != cur->right_fringe_face_id
860 || cur->redraw_fringe_bitmaps_p)
861 {
862 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
863 cur->left_fringe_bitmap = left;
864 cur->right_fringe_bitmap = right;
865 cur->left_fringe_face_id = left_face_id;
866 cur->right_fringe_face_id = right_face_id;
867 }
868
869 if (row->overlay_arrow_p != cur->overlay_arrow_p)
870 {
871 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
872 cur->overlay_arrow_p = row->overlay_arrow_p;
873 }
874
875 row->left_fringe_bitmap = left;
876 row->right_fringe_bitmap = right;
877 row->left_fringe_face_id = left_face_id;
878 row->right_fringe_face_id = right_face_id;
879 }
880
881 return redraw_p;
882 }
883
884
885 /* Compute actual fringe widths for frame F.
886
887 If REDRAW is 1, redraw F if the fringe settings was actually
888 modified and F is visible.
889
890 Since the combined left and right fringe must occupy an integral
891 number of columns, we may need to add some pixels to each fringe.
892 Typically, we add an equal amount (+/- 1 pixel) to each fringe,
893 but a negative width value is taken literally (after negating it).
894
895 We never make the fringes narrower than specified. It is planned
896 to make fringe bitmaps customizable and expandable, and at that
897 time, the user will typically specify the minimum number of pixels
898 needed for his bitmaps, so we shouldn't select anything less than
899 what is specified.
900 */
901
902 void
903 compute_fringe_widths (f, redraw)
904 struct frame *f;
905 int redraw;
906 {
907 int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
908 int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
909 int o_cols = FRAME_FRINGE_COLS (f);
910
911 Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);
912 Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);
913 int left_fringe_width, right_fringe_width;
914
915 if (!NILP (left_fringe))
916 left_fringe = Fcdr (left_fringe);
917 if (!NILP (right_fringe))
918 right_fringe = Fcdr (right_fringe);
919
920 left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 :
921 XINT (left_fringe));
922 right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 :
923 XINT (right_fringe));
924
925 if (left_fringe_width || right_fringe_width)
926 {
927 int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width;
928 int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width;
929 int conf_wid = left_wid + right_wid;
930 int font_wid = FRAME_COLUMN_WIDTH (f);
931 int cols = (left_wid + right_wid + font_wid-1) / font_wid;
932 int real_wid = cols * font_wid;
933 if (left_wid && right_wid)
934 {
935 if (left_fringe_width < 0)
936 {
937 /* Left fringe width is fixed, adjust right fringe if necessary */
938 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid;
939 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;
940 }
941 else if (right_fringe_width < 0)
942 {
943 /* Right fringe width is fixed, adjust left fringe if necessary */
944 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;
945 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid;
946 }
947 else
948 {
949 /* Adjust both fringes with an equal amount.
950 Note that we are doing integer arithmetic here, so don't
951 lose a pixel if the total width is an odd number. */
952 int fill = real_wid - conf_wid;
953 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;
954 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;
955 }
956 }
957 else if (left_fringe_width)
958 {
959 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid;
960 FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
961 }
962 else
963 {
964 FRAME_LEFT_FRINGE_WIDTH (f) = 0;
965 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid;
966 }
967 FRAME_FRINGE_COLS (f) = cols;
968 }
969 else
970 {
971 FRAME_LEFT_FRINGE_WIDTH (f) = 0;
972 FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
973 FRAME_FRINGE_COLS (f) = 0;
974 }
975
976 if (redraw && FRAME_VISIBLE_P (f))
977 if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) ||
978 o_right != FRAME_RIGHT_FRINGE_WIDTH (f) ||
979 o_cols != FRAME_FRINGE_COLS (f))
980 redraw_frame (f);
981 }
982
983 DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap,
984 1, 1, 0,
985 doc: /* Destroy fringe bitmap WHICH.
986 If WHICH overrides a standard fringe bitmap, the original bitmap is restored. */)
987 (which)
988 Lisp_Object which;
989 {
990 int n;
991 struct fringe_bitmap **fbp;
992
993 CHECK_NUMBER (which);
994 if (n = XINT (which), n >= max_used_fringe_bitmap)
995 return Qnil;
996
997 fringe_faces[n] = FRINGE_FACE_ID;
998
999 fbp = &fringe_bitmaps[n];
1000 if (*fbp && (*fbp)->dynamic)
1001 {
1002 /* XXX Is SELECTED_FRAME OK here? */
1003 if (FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap)
1004 FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap (n);
1005 xfree (*fbp);
1006 *fbp = NULL;
1007 }
1008
1009 while (max_used_fringe_bitmap > MAX_STANDARD_FRINGE_BITMAPS
1010 && fringe_bitmaps[max_used_fringe_bitmap - 1] == NULL)
1011 max_used_fringe_bitmap--;
1012
1013 return Qnil;
1014 }
1015
1016
1017 /* Initialize bitmap bit.
1018
1019 On X, we bit-swap the built-in bitmaps and reduce bitmap
1020 from short to char array if width is <= 8 bits.
1021
1022 On MAC with big-endian CPU, we need to byte-swap each short.
1023
1024 On W32 and MAC (little endian), there's no need to do this.
1025 */
1026
1027 void
1028 init_fringe_bitmap (which, fb, once_p)
1029 enum fringe_bitmap_type which;
1030 struct fringe_bitmap *fb;
1031 int once_p;
1032 {
1033 if (once_p || fb->dynamic)
1034 {
1035 #if defined (HAVE_X_WINDOWS)
1036 static unsigned char swap_nibble[16]
1037 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
1038 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
1039 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
1040 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */
1041 unsigned short *bits = fb->bits;
1042 int j;
1043
1044 if (fb->width <= 8)
1045 {
1046 unsigned char *cbits = (unsigned char *)fb->bits;
1047 for (j = 0; j < fb->height; j++)
1048 {
1049 unsigned short b = *bits++;
1050 unsigned char c;
1051 c = (unsigned char)((swap_nibble[b & 0xf] << 4)
1052 | (swap_nibble[(b>>4) & 0xf]));
1053 *cbits++ = (c >> (8 - fb->width));
1054 }
1055 }
1056 else
1057 {
1058 for (j = 0; j < fb->height; j++)
1059 {
1060 unsigned short b = *bits;
1061 b = (unsigned short)((swap_nibble[b & 0xf] << 12)
1062 | (swap_nibble[(b>>4) & 0xf] << 8)
1063 | (swap_nibble[(b>>8) & 0xf] << 4)
1064 | (swap_nibble[(b>>12) & 0xf]));
1065 *bits++ = (b >> (16 - fb->width));
1066 }
1067 }
1068 #endif /* HAVE_X_WINDOWS */
1069
1070 #if defined (MAC_OS) && defined (WORDS_BIG_ENDIAN)
1071 unsigned short *bits = fb->bits;
1072 int j;
1073 for (j = 0; j < fb->height; j++)
1074 {
1075 unsigned short b = *bits;
1076 *bits++ = ((b >> 8) & 0xff) | ((b & 0xff) << 8);
1077 }
1078 #endif /* MAC_OS && WORDS_BIG_ENDIAN */
1079 }
1080
1081 if (!once_p)
1082 {
1083 Fdestroy_fringe_bitmap (make_number (which));
1084
1085 /* XXX Is SELECTED_FRAME OK here? */
1086 if (FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap)
1087 FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
1088
1089 fringe_bitmaps[which] = fb;
1090 if (which >= max_used_fringe_bitmap)
1091 max_used_fringe_bitmap = which + 1;
1092 }
1093 }
1094
1095
1096 DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
1097 1, 5, 0,
1098 doc: /* Define a fringe bitmap from BITS of height HEIGHT and width WIDTH.
1099 BITS is either a string or a vector of integers.
1100 HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS.
1101 WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
1102 Optional forth arg ALIGN may be one of `top', `center', or `bottom',
1103 indicating the positioning of the bitmap relative to the rows where it
1104 is used; the default is to center the bitmap. Fourth arg may also be a
1105 list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
1106 should be repeated.
1107 Optional fifth argument WHICH is bitmap number to redefine.
1108 Return new bitmap number, or nil of no more free bitmap slots. */)
1109 (bits, height, width, align, which)
1110 Lisp_Object bits, height, width, align, which;
1111 {
1112 Lisp_Object len;
1113 int n, h, i, j;
1114 unsigned short *b;
1115 struct fringe_bitmap fb, *xfb;
1116 int fill1 = 0, fill2 = 0;
1117
1118 if (!STRINGP (bits) && !VECTORP (bits))
1119 bits = wrong_type_argument (Qstringp, bits);
1120
1121 len = Flength (bits);
1122
1123 if (NILP (height))
1124 h = fb.height = XINT (len);
1125 else
1126 {
1127 CHECK_NUMBER (height);
1128 fb.height = min (XINT (height), 255);
1129 if (fb.height > XINT (len))
1130 {
1131 h = XINT (len);
1132 fill1 = (fb.height - h) / 2;
1133 fill2 = fb.height - h - fill1;
1134 }
1135 }
1136
1137 if (NILP (width))
1138 fb.width = 8;
1139 else
1140 {
1141 CHECK_NUMBER (width);
1142 fb.width = min (XINT (width), 255);
1143 }
1144
1145 fb.period = 0;
1146 fb.align = ALIGN_BITMAP_CENTER;
1147
1148 if (CONSP (align))
1149 {
1150 Lisp_Object period = XCDR (align);
1151 if (CONSP (period))
1152 {
1153 period = XCAR (period);
1154 if (!NILP (period))
1155 {
1156 fb.period = fb.height;
1157 fb.height = 255;
1158 }
1159 }
1160 align = XCAR (align);
1161 }
1162 if (EQ (align, Qtop))
1163 fb.align = ALIGN_BITMAP_TOP;
1164 else if (EQ (align, Qbottom))
1165 fb.align = ALIGN_BITMAP_BOTTOM;
1166 else if (!NILP (align) && !EQ (align, Qcenter))
1167 error ("Bad align argument");
1168
1169 if (NILP (which))
1170 {
1171 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS)
1172 n = max_used_fringe_bitmap++;
1173 else
1174 {
1175 for (n = MAX_STANDARD_FRINGE_BITMAPS;
1176 n < MAX_FRINGE_BITMAPS;
1177 n++)
1178 if (fringe_bitmaps[n] == NULL)
1179 break;
1180 if (n == MAX_FRINGE_BITMAPS)
1181 return Qnil;
1182 }
1183 which = make_number (n);
1184 }
1185 else
1186 {
1187 CHECK_NUMBER (which);
1188 n = XINT (which);
1189 if (n <= NO_FRINGE_BITMAP || n >= MAX_FRINGE_BITMAPS)
1190 error ("Invalid fringe bitmap number");
1191 }
1192
1193 fb.dynamic = 1;
1194
1195 xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
1196 + fb.height * BYTES_PER_BITMAP_ROW);
1197 fb.bits = b = (unsigned short *) (xfb + 1);
1198 bzero (b, fb.height);
1199
1200 j = 0;
1201 while (j < fb.height)
1202 {
1203 for (i = 0; i < fill1 && j < fb.height; i++)
1204 b[j++] = 0;
1205 for (i = 0; i < h && j < fb.height; i++)
1206 {
1207 Lisp_Object elt = Faref (bits, make_number (i));
1208 b[j++] = NUMBERP (elt) ? XINT (elt) : 0;
1209 }
1210 for (i = 0; i < fill2 && j < fb.height; i++)
1211 b[j++] = 0;
1212 }
1213
1214 *xfb = fb;
1215
1216 init_fringe_bitmap (n, xfb, 0);
1217
1218 return which;
1219 }
1220
1221 DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face,
1222 1, 2, 0,
1223 doc: /* Set face for fringe bitmap FRINGE-ID to FACE.
1224 If FACE is nil, reset face to default fringe face. */)
1225 (fringe_id, face)
1226 Lisp_Object fringe_id, face;
1227 {
1228 int face_id;
1229
1230 CHECK_NUMBER (fringe_id);
1231 if (!valid_fringe_bitmap_id_p (XINT (fringe_id)))
1232 error ("Invalid fringe id");
1233
1234 if (!NILP (face))
1235 {
1236 face_id = lookup_named_face (SELECTED_FRAME (), face, 'A');
1237 if (face_id < 0)
1238 error ("No such face");
1239 }
1240 else
1241 face_id = FRINGE_FACE_ID;
1242
1243 fringe_faces [XINT (fringe_id)] = face_id;
1244
1245 return Qnil;
1246 }
1247
1248 DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos,
1249 0, 2, 0,
1250 doc: /* Return fringe bitmaps of row containing position POS in window WINDOW.
1251 If WINDOW is nil, use selected window. If POS is nil, use value of point
1252 in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT
1253 are the fringe bitmap numbers for the bitmaps in the left and right fringe,
1254 resp. Return nil if POS is not visible in WINDOW. */)
1255 (pos, window)
1256 Lisp_Object pos, window;
1257 {
1258 struct window *w;
1259 struct buffer *old_buffer = NULL;
1260 struct glyph_row *row;
1261 int textpos;
1262
1263 if (NILP (window))
1264 window = selected_window;
1265 CHECK_WINDOW (window);
1266 w = XWINDOW (window);
1267
1268 if (!NILP (pos))
1269 {
1270 CHECK_NUMBER_COERCE_MARKER (pos);
1271 textpos = XINT (pos);
1272 }
1273 else if (w == XWINDOW (selected_window))
1274 textpos = PT;
1275 else
1276 textpos = XMARKER (w->pointm)->charpos;
1277
1278 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1279 row = row_containing_pos (w, textpos, row, NULL, 0);
1280 if (row)
1281 return Fcons (make_number (row->left_fringe_bitmap),
1282 make_number (row->right_fringe_bitmap));
1283 else
1284 return Qnil;
1285 }
1286
1287
1288 /***********************************************************************
1289 Initialization
1290 ***********************************************************************/
1291
1292 void
1293 syms_of_fringe ()
1294 {
1295
1296 defsubr (&Sdestroy_fringe_bitmap);
1297 defsubr (&Sdefine_fringe_bitmap);
1298 defsubr (&Sfringe_bitmaps_at_pos);
1299 defsubr (&Sset_fringe_bitmap_face);
1300
1301 DEFVAR_LISP ("overflow-newline-into-fringe", &Voverflow_newline_into_fringe,
1302 doc: /* *Non-nil means that newline may flow into the right fringe.
1303 This means that display lines which are exactly as wide as the window
1304 (not counting the final newline) will only occupy one screen line, by
1305 showing (or hiding) the final newline in the right fringe; when point
1306 is at the final newline, the cursor is shown in the right fringe.
1307 If nil, also continue lines which are exactly as wide as the window. */);
1308 Voverflow_newline_into_fringe = Qt;
1309
1310 }
1311
1312 /* Initialize this module when Emacs starts. */
1313
1314 void
1315 init_fringe_once ()
1316 {
1317 enum fringe_bitmap_type bt;
1318
1319 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
1320 init_fringe_bitmap(bt, &standard_bitmaps[bt], 1);
1321 }
1322
1323 void
1324 init_fringe ()
1325 {
1326 int i;
1327
1328 bzero (fringe_bitmaps, sizeof fringe_bitmaps);
1329 for (i = 0; i < MAX_FRINGE_BITMAPS; i++)
1330 fringe_faces[i] = FRINGE_FACE_ID;
1331 }
1332
1333 #ifdef HAVE_NTGUI
1334
1335 void
1336 w32_init_fringe ()
1337 {
1338 enum fringe_bitmap_type bt;
1339
1340 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
1341 {
1342 struct fringe_bitmap *fb = &standard_bitmaps[bt];
1343 rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
1344 }
1345 }
1346
1347 void
1348 w32_reset_fringes ()
1349 {
1350 /* Destroy row bitmaps. */
1351 int bt;
1352
1353 for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++)
1354 rif->destroy_fringe_bitmap (bt);
1355 }
1356
1357 #endif /* HAVE_NTGUI */
1358
1359 #endif /* HAVE_WINDOW_SYSTEM */
1360
1361 /* arch-tag: 04596920-43eb-473d-b319-82712338162d
1362 (do not change this comment) */