]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #10464 with mouse highlight of display strings.
authorEli Zaretskii <eliz@gnu.org>
Mon, 9 Jan 2012 20:45:49 +0000 (22:45 +0200)
committerEli Zaretskii <eliz@gnu.org>
Mon, 9 Jan 2012 20:45:49 +0000 (22:45 +0200)
 src/xdisp.c (rows_from_pos_range): Accept additional argument
 DISP_STRING, and accept any glyph in a row whose object is that
 string as eligible for mouse highlight.  Fixes mouse highlight of
 display strings from overlays.

src/ChangeLog
src/xdisp.c

index 6ef11faea1994bda77ce73728203f8c908b14fa8..9af9b88feeffcd3fef5864154f9f2dc0a4c88c06 100644 (file)
@@ -1,3 +1,10 @@
+2012-01-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (rows_from_pos_range): Accept additional argument
+       DISP_STRING, and accept any glyph in a row whose object is that
+       string as eligible for mouse highlight.  Fixes mouse highlight of
+       display strings from overlays.  (Bug#10464)
+
 2012-01-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        emacs: fix an auto-save permissions race condition (Bug#10400)
index 9427682c6118913cd1c816b717185d1c1a112d3c..c3bda5594b242c507b259239ec4c687d99555257 100644 (file)
@@ -25817,12 +25817,14 @@ cursor_in_mouse_face_p (struct window *w)
 \f
 /* Find the glyph rows START_ROW and END_ROW of window W that display
    characters between buffer positions START_CHARPOS and END_CHARPOS
-   (excluding END_CHARPOS).  This is similar to row_containing_pos,
-   but is more accurate when bidi reordering makes buffer positions
-   change non-linearly with glyph rows.  */
+   (excluding END_CHARPOS).  DISP_STRING is a display string that
+   covers these buffer positions.  This is similar to
+   row_containing_pos, but is more accurate when bidi reordering makes
+   buffer positions change non-linearly with glyph rows.  */
 static void
 rows_from_pos_range (struct window *w,
                     EMACS_INT start_charpos, EMACS_INT end_charpos,
+                    Lisp_Object disp_string,
                     struct glyph_row **start, struct glyph_row **end)
 {
   struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
@@ -25874,8 +25876,11 @@ rows_from_pos_range (struct window *w,
 
          while (g < e)
            {
-             if ((BUFFERP (g->object) || INTEGERP (g->object))
-                 && start_charpos <= g->charpos && g->charpos < end_charpos)
+             if (((BUFFERP (g->object) || INTEGERP (g->object))
+                  && start_charpos <= g->charpos && g->charpos < end_charpos)
+                 /* A glyph that comes from DISP_STRING is by
+                    definition to be highlighted.  */
+                 || EQ (g->object, disp_string))
                *start = row;
              g++;
            }
@@ -25924,8 +25929,11 @@ rows_from_pos_range (struct window *w,
 
          while (g < e)
            {
-             if ((BUFFERP (g->object) || INTEGERP (g->object))
-                 && start_charpos <= g->charpos && g->charpos < end_charpos)
+             if (((BUFFERP (g->object) || INTEGERP (g->object))
+                  && start_charpos <= g->charpos && g->charpos < end_charpos)
+                 /* A glyph that comes from DISP_STRING is by
+                    definition to be highlighted.  */
+                 || EQ (g->object, disp_string))
                break;
              g++;
            }
@@ -25969,7 +25977,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
   xassert (NILP (after_string) || STRINGP (after_string));
 
   /* Find the rows corresponding to START_CHARPOS and END_CHARPOS.  */
-  rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2);
+  rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2);
   if (r1 == NULL)
     r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
   /* If the before-string or display-string contains newlines,