/* Fringe handling (split from xdisp.c).
- Copyright (C) 1985-1988, 1993-1995, 1997-2011 Free Software Foundation, Inc.
+ Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "frame.h"
#include "window.h"
#include "dispextern.h"
+#include "character.h"
#include "buffer.h"
#include "blockinput.h"
#include "termhooks.h"
static unsigned short question_mark_bits[] = {
0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18};
+/* An exclamation mark. */
+/*
+ ...XX...
+ ...XX...
+ ...XX...
+ ...XX...
+ ...XX...
+ ...XX...
+ ...XX...
+ ........
+ ...XX...
+ ...XX...
+*/
+static unsigned short exclamation_mark_bits[] = {
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18};
+
/* An arrow like this: `<-'. */
/*
...xx...
{
{ NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */
{ FRBITS (question_mark_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
+ { FRBITS (exclamation_mark_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
{ FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
{ FRBITS (right_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 },
{ FRBITS (up_arrow_bits), 8, 0, ALIGN_BITMAP_TOP, 0 },
int
lookup_fringe_bitmap (Lisp_Object bitmap)
{
- int bn;
+ EMACS_INT bn;
bitmap = Fget (bitmap, Qfringe);
if (!INTEGERP (bitmap))
get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p)
{
Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm;
- int ln1 = 0, ln2 = 0;
+ EMACS_INT ln1 = 0, ln2 = 0;
int ix1 = right_p;
int ix2 = ix1 + (partial_p ? 2 : 0);
void
draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
{
- xassert (interrupt_input_blocked);
+ eassert (interrupt_input_blocked);
/* If row is completely invisible, because of vscrolling, we
don't have to draw anything. */
else
{
CHECK_NUMBER (height);
- fb.height = min (XINT (height), 255);
+ fb.height = max (0, min (XINT (height), 255));
if (fb.height > h)
{
fill1 = (fb.height - h) / 2;
else
{
CHECK_NUMBER (width);
- fb.width = min (XINT (width), 255);
+ fb.width = max (0, min (XINT (width), 255));
}
fb.period = 0;
error ("No free fringe bitmap slots");
i = max_fringe_bitmaps;
- fringe_bitmaps
- = ((struct fringe_bitmap **)
- xrealloc (fringe_bitmaps, bitmaps * sizeof *fringe_bitmaps));
- fringe_faces
- = (Lisp_Object *) xrealloc (fringe_faces,
- bitmaps * sizeof *fringe_faces);
+ fringe_bitmaps = xrealloc (fringe_bitmaps,
+ bitmaps * sizeof *fringe_bitmaps);
+ fringe_faces = xrealloc (fringe_faces,
+ bitmaps * sizeof *fringe_faces);
for (i = max_fringe_bitmaps; i < bitmaps; i++)
{
fb.dynamic = 1;
- xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
- + fb.height * BYTES_PER_BITMAP_ROW);
+ xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
fb.bits = b = (unsigned short *) (xfb + 1);
memset (b, 0, fb.height);
(Lisp_Object bitmap, Lisp_Object face)
{
int n;
- int face_id;
CHECK_SYMBOL (bitmap);
n = lookup_fringe_bitmap (bitmap);
if (!n)
error ("Undefined fringe bitmap");
+ /* The purpose of the following code is to signal an error if FACE
+ is not a face. This is for the caller's convenience only; the
+ redisplay code should be able to fail gracefully. Skip the check
+ if FRINGE_FACE_ID is unrealized (as in batch mode and during
+ daemon startup). */
if (!NILP (face))
{
- face_id = lookup_derived_face (SELECTED_FRAME (), face,
- FRINGE_FACE_ID, 1);
- if (face_id < 0)
+ struct frame *f = SELECTED_FRAME ();
+
+ if (FACE_FROM_ID (f, FRINGE_FACE_ID)
+ && lookup_derived_face (f, face, FRINGE_FACE_ID, 1) < 0)
error ("No such face");
}
fringe_faces[n] = face;
-
return Qnil;
}
{
struct window *w;
struct glyph_row *row;
- int textpos;
+ ptrdiff_t textpos;
if (NILP (window))
window = selected_window;
if (!NILP (pos))
{
CHECK_NUMBER_COERCE_MARKER (pos);
+ if (! (BEGV <= XINT (pos) && XINT (pos) <= ZV))
+ args_out_of_range (window, pos);
textpos = XINT (pos);
}
else if (w == XWINDOW (selected_window))
defsubr (&Sset_fringe_bitmap_face);
DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe,
- doc: /* *Non-nil means that newline may flow into the right fringe.
+ doc: /* Non-nil means that newline may flow into the right fringe.
This means that display lines which are exactly as wide as the window
(not counting the final newline) will only occupy one screen line, by
showing (or hiding) the final newline in the right fringe; when point
max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
- fringe_bitmaps
- = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
- fringe_faces
- = (Lisp_Object *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
+ fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
+ fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces);
for (i = 0; i < max_fringe_bitmaps; i++)
- {
- fringe_bitmaps[i] = NULL;
- fringe_faces[i] = Qnil;
- }
+ fringe_faces[i] = Qnil;
}
#ifdef HAVE_NTGUI