mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
Make sure mouse face doesn't stay on the cursor after it is cleared
cursor_in_mouse_face_p will still return true when the phys cursor is drawn inside show_mouse_face when called by clear_mouse_face, since that drawing happens before hlinfo->mouse_face_window can be set to nil. However, the row's mouse_face_p will be adjusted before the cursor is drawn in show_mouse_face, so it can be used to determine if the cursor is actually under mouse face. * src/xdisp.c (fill_composite_glyph_string): (fill_gstring_glyph_string): (fill_glyphless_glyph_string): (fill_glyph_string): (fill_xwidget_glyph_string): (fill_stretch_glyph_string): Only apply mouse face when DRAW_CURSOR if the row is also mouse_face_p. (set_glyph_string_background_width): Only adjust width if the row holding the cursor is also mouse_face_p.
This commit is contained in:
parent
8875ae70a4
commit
e1626257ab
1 changed files with 30 additions and 7 deletions
37
src/xdisp.c
37
src/xdisp.c
|
|
@ -28549,7 +28549,10 @@ fill_composite_glyph_string (struct glyph_string *s, struct face *base_face,
|
|||
}
|
||||
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
int c = COMPOSITION_GLYPH (s->cmp, 0);
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
|
|
@ -28598,7 +28601,10 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
|
|||
s->cmp_from = glyph->slice.cmp.from;
|
||||
s->cmp_to = glyph->slice.cmp.to + 1;
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -28664,7 +28670,10 @@ fill_glyphless_glyph_string (struct glyph_string *s, int face_id,
|
|||
s->face = FACE_FROM_ID (s->f, face_id);
|
||||
s->font = s->face->font ? s->face->font : FRAME_FONT (s->f);
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -28736,7 +28745,10 @@ fill_glyph_string (struct glyph_string *s, int face_id,
|
|||
s->font = s->face->font;
|
||||
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -28778,7 +28790,10 @@ fill_image_glyph_string (struct glyph_string *s)
|
|||
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
|
||||
s->font = s->face->font;
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -28801,7 +28816,10 @@ fill_xwidget_glyph_string (struct glyph_string *s)
|
|||
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
|
||||
s->font = s->face->font;
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -28835,7 +28853,10 @@ fill_stretch_glyph_string (struct glyph_string *s, int start, int end)
|
|||
s->face = FACE_FROM_ID (s->f, face_id);
|
||||
s->font = s->face->font;
|
||||
if (s->hl == DRAW_MOUSE_FACE
|
||||
|| (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w)))
|
||||
|| (s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w)))
|
||||
{
|
||||
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f);
|
||||
s->face = FACE_FROM_ID_OR_NULL (s->f, hlinfo->mouse_face_face_id);
|
||||
|
|
@ -29122,6 +29143,8 @@ set_glyph_string_background_width (struct glyph_string *s, int start, int last_x
|
|||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
if (FRAME_WINDOW_P (s->f)
|
||||
&& s->hl == DRAW_CURSOR
|
||||
&& MATRIX_ROW (s->w->current_matrix,
|
||||
s->w->phys_cursor.vpos)->mouse_face_p
|
||||
&& cursor_in_mouse_face_p (s->w))
|
||||
{
|
||||
/* Adjust the background width of the glyph string, because
|
||||
|
|
|
|||
Loading…
Reference in a new issue