mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-13 16:38:14 +00:00
(compute_char_face): New args REGION_BEG, REGION_END.
Don't sort if noverlays is 0 or 1.
This commit is contained in:
parent
de83c3149e
commit
bc0db68d47
32
src/xfaces.c
32
src/xfaces.c
@ -133,6 +133,9 @@ int nfaces_allocated;
|
|||||||
/* The number of face-id's in use (same for all frames). */
|
/* The number of face-id's in use (same for all frames). */
|
||||||
int next_face_id;
|
int next_face_id;
|
||||||
|
|
||||||
|
/* The number of the face to use to indicate the region. */
|
||||||
|
int region_face;
|
||||||
|
|
||||||
#define FACE_DEFAULT (~0)
|
#define FACE_DEFAULT (~0)
|
||||||
|
|
||||||
Lisp_Object Qface, Qwindow, Qpriority;
|
Lisp_Object Qface, Qwindow, Qpriority;
|
||||||
@ -616,12 +619,16 @@ sort_overlays (s1, s2)
|
|||||||
Store into *ENDPTR the position at which a different face is needed.
|
Store into *ENDPTR the position at which a different face is needed.
|
||||||
This does not take account of glyphs that specify their own face codes.
|
This does not take account of glyphs that specify their own face codes.
|
||||||
F is the frame in use for display, and W is a window displaying
|
F is the frame in use for display, and W is a window displaying
|
||||||
the current buffer. */
|
the current buffer.
|
||||||
|
|
||||||
|
REGION_BEG, REGION_END delimit the region, so it can be highlighted. */
|
||||||
|
|
||||||
int
|
int
|
||||||
compute_char_face (f, w, pos, endptr)
|
compute_char_face (f, w, pos, region_beg, region_end, endptr)
|
||||||
struct frame *f;
|
struct frame *f;
|
||||||
struct window *w;
|
struct window *w;
|
||||||
int pos;
|
int pos;
|
||||||
|
int region_beg, region_end;
|
||||||
int *endptr;
|
int *endptr;
|
||||||
{
|
{
|
||||||
struct face face;
|
struct face face;
|
||||||
@ -642,6 +649,8 @@ compute_char_face (f, w, pos, endptr)
|
|||||||
XSET (frame, Lisp_Frame, f);
|
XSET (frame, Lisp_Frame, f);
|
||||||
|
|
||||||
endpos = ZV;
|
endpos = ZV;
|
||||||
|
if (pos < region_beg && region_beg < endpos)
|
||||||
|
endpos = region_beg;
|
||||||
|
|
||||||
XFASTINT (position) = pos;
|
XFASTINT (position) = pos;
|
||||||
prop = Fget_text_property (position, Qface, w->buffer);
|
prop = Fget_text_property (position, Qface, w->buffer);
|
||||||
@ -666,7 +675,8 @@ compute_char_face (f, w, pos, endptr)
|
|||||||
*endptr = endpos;
|
*endptr = endpos;
|
||||||
|
|
||||||
/* Optimize the default case. */
|
/* Optimize the default case. */
|
||||||
if (noverlays == 0 && NILP (prop))
|
if (noverlays == 0 && NILP (prop)
|
||||||
|
&& !(pos >= region_beg && pos < region_end))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (struct face));
|
bcopy (FRAME_DEFAULT_FACE (f), &face, sizeof (struct face));
|
||||||
@ -719,7 +729,8 @@ compute_char_face (f, w, pos, endptr)
|
|||||||
|
|
||||||
/* Sort the overlays into the proper order: increasing priority. */
|
/* Sort the overlays into the proper order: increasing priority. */
|
||||||
|
|
||||||
qsort (sortvec, noverlays, sizeof (struct sortvec), sort_overlays);
|
if (noverlays > 1)
|
||||||
|
qsort (sortvec, noverlays, sizeof (struct sortvec), sort_overlays);
|
||||||
|
|
||||||
/* Now merge the overlay data in that order. */
|
/* Now merge the overlay data in that order. */
|
||||||
for (i = 0; i < noverlays; i++)
|
for (i = 0; i < noverlays; i++)
|
||||||
@ -742,6 +753,14 @@ compute_char_face (f, w, pos, endptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pos >= region_beg && pos < region_end)
|
||||||
|
{
|
||||||
|
if (region_end < endpos)
|
||||||
|
endpos = region_end;
|
||||||
|
if (region_face >= 0 && region_face < next_face_id)
|
||||||
|
merge_faces (FRAME_FACES (f) [region_face], &face);
|
||||||
|
}
|
||||||
|
|
||||||
xfree (overlay_vec);
|
xfree (overlay_vec);
|
||||||
|
|
||||||
*endptr = endpos;
|
*endptr = endpos;
|
||||||
@ -939,6 +958,11 @@ syms_of_xfaces ()
|
|||||||
Qpriority = intern ("priority");
|
Qpriority = intern ("priority");
|
||||||
staticpro (&Qpriority);
|
staticpro (&Qpriority);
|
||||||
|
|
||||||
|
DEFVAR_INT ("region-face", ®ion_face,
|
||||||
|
"Face number to use to highlight the region\n\
|
||||||
|
The region is highlighted with this face\n\
|
||||||
|
when Transient Mark mode is enabled and the mark is active.");
|
||||||
|
|
||||||
defsubr (&Sframe_face_alist);
|
defsubr (&Sframe_face_alist);
|
||||||
defsubr (&Sset_frame_face_alist);
|
defsubr (&Sset_frame_face_alist);
|
||||||
defsubr (&Smake_face_internal);
|
defsubr (&Smake_face_internal);
|
||||||
|
Loading…
Reference in New Issue
Block a user