emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e8c6e3fa477: Fix bug#70385


From: Po Lu
Subject: master e8c6e3fa477: Fix bug#70385
Date: Sun, 14 Apr 2024 21:33:06 -0400 (EDT)

branch: master
commit e8c6e3fa477e69b4cecfee354af313ccb60e8c97
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix bug#70385
    
    * 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)
---
 src/xdisp.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 452adee1d31..d984c12d1aa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]