]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug#70385
authorPo Lu <luangruo@yahoo.com>
Mon, 15 Apr 2024 01:21:17 +0000 (09:21 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 20 Apr 2024 11:00:30 +0000 (14:00 +0300)
* src/xdisp.c (note_fringe_highlight): Don't proceed if
popup_activated, window is outdated, or when row beneath pointer
does not display text.  (bug#70385)

(cherry picked from commit e8c6e3fa477e69b4cecfee354af313ccb60e8c97)

src/xdisp.c

index 452adee1d317f81402ef07b376d29d4e7eb5468d..d984c12d1aad181c9f0efe2e14e7163cc8b95110 100644 (file)
@@ -35731,16 +35731,28 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
 
 
 /* Take proper action when mouse has moved to the window WINDOW, with
-   window-local x-position X and y-position Y. This is only used for
+   window-local x-position X and y-position Y.  This is only used for
    displaying user-defined fringe indicator help-echo messages.  */
 
 static void
-note_fringe_highlight (Lisp_Object window, int x, int y,
+note_fringe_highlight (struct frame *f, Lisp_Object window, int x, int y,
                       enum window_part part)
 {
-  if (!NILP (help_echo_string))
+  if (!NILP (help_echo_string) || !f->glyphs_initialized_p)
     return;
 
+  /* When a menu is active, don't highlight because this looks odd.  */
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) || defined (MSDOS) \
+  || defined (HAVE_ANDROID)
+  if (popup_activated ())
+    return;
+#endif /* HAVE_X_WINDOWS || HAVE_NS || MSDOS || HAVE_ANDROID */
+
+#if defined HAVE_HAIKU
+  if (popup_activated_p)
+    return;
+#endif /* HAVE_HAIKU */
+
   /* Find a message to display through the help-echo mechanism whenever
      the mouse hovers over a fringe indicator.  Both text properties and
      overlays have to be checked.  */
@@ -35757,6 +35769,13 @@ note_fringe_highlight (Lisp_Object window, int x, int y,
   struct window *w = XWINDOW (window);
   x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, 0, 0, &area);
 
+  /* Don't access the TEXT_AREA of a row that does not display text, or
+     when the window is outdated.  (bug#70385) */
+  if (window_outdated (w)
+      || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix,
+                                                 vpos)))
+    return;
+
   /* Get to the first glyph of a text row based on the vertical position
      of the fringe.  */
   struct glyph *glyph = MATRIX_ROW_GLYPH_START (w->current_matrix, vpos);
@@ -36014,7 +36033,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
   else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE)
     {
       cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor;
-      note_fringe_highlight (window, x, y, part);
+      note_fringe_highlight (f, window, x, y, part);
     }
   else if (part == ON_VERTICAL_SCROLL_BAR
           || part == ON_HORIZONTAL_SCROLL_BAR)