[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e1626257ab: Make sure mouse face doesn't stay on the cursor after
From: |
Po Lu |
Subject: |
master e1626257ab: Make sure mouse face doesn't stay on the cursor after it is cleared |
Date: |
Wed, 5 Jan 2022 02:00:43 -0500 (EST) |
branch: master
commit e1626257ab984c129aaeb8de6a1e4ec5ef1d2e13
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/xdisp.c | 37 ++++++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 0635cad0d1..2326df4300 100644
--- a/src/xdisp.c
+++ b/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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e1626257ab: Make sure mouse face doesn't stay on the cursor after it is cleared,
Po Lu <=