aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2022-11-09 16:25:02 +0200
committerEli Zaretskii2022-11-09 16:25:02 +0200
commit85b0587a93bdb80c4c304a39cb5ffd3600c95a16 (patch)
tree7f1806391c22f78eda48038a193503df48954bab /src
parent6d1af1560e3b815d68759921a12bee0c80aa5c39 (diff)
downloademacs-85b0587a93bdb80c4c304a39cb5ffd3600c95a16.tar.gz
emacs-85b0587a93bdb80c4c304a39cb5ffd3600c95a16.zip
Avoid assertion violations in matrix_row
* src/xdisp.c (cursor_in_mouse_face_p): Avoid rare assertion violations when the cursor's VPOS winds up being invalid for the window. (Bug#59147)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 95da704a070..f6a279636a0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33564,8 +33564,14 @@ coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
33564bool 33564bool
33565cursor_in_mouse_face_p (struct window *w) 33565cursor_in_mouse_face_p (struct window *w)
33566{ 33566{
33567 int hpos = w->phys_cursor.hpos;
33568 int vpos = w->phys_cursor.vpos; 33567 int vpos = w->phys_cursor.vpos;
33568
33569 /* If the cursor is outside the matrix glyph rows, it cannot be
33570 within the mouse face. */
33571 if (!(0 <= vpos && vpos < w->current_matrix->nrows))
33572 return false;
33573
33574 int hpos = w->phys_cursor.hpos;
33569 struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos); 33575 struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos);
33570 33576
33571 /* When the window is hscrolled, cursor hpos can legitimately be out 33577 /* When the window is hscrolled, cursor hpos can legitimately be out