changeset 111113:3f3a9d92dcbe

Tested with L2R rows and mouse highlight on a single line. xdisp.c (mouse_face_from_string_pos): Initialize the `found' flag to zero, and exit the outer loop when it's non-zero. Bail our early if no row in the window belongs to the highlighted string. Always back up after exiting the second loop.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 23 Oct 2010 14:28:28 +0200
parents 28595721f736
children 674f04c442a5
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Oct 16 18:14:16 2010 +0200
+++ b/src/ChangeLog	Sat Oct 23 14:28:28 2010 +0200
@@ -1,3 +1,10 @@
+2010-10-23  Eli Zaretskii  <eliz@gnu.org>
+
+	* xdisp.c (mouse_face_from_string_pos): Initialize the `found'
+	flag to zero, and exit the outer loop when it's non-zero.  Bail
+	our early if no row in the window belongs to the highlighted
+	string.  Always back up after exiting the second loop.
+
 2010-10-16  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (fast_find_string_pos): #ifdef away, not used anymore.
--- a/src/xdisp.c	Sat Oct 16 18:14:16 2010 +0200
+++ b/src/xdisp.c	Sat Oct 23 14:28:28 2010 +0200
@@ -24422,7 +24422,7 @@
   struct glyph_row *r;
   struct glyph *g, *e;
   int gx;
-  int found;
+  int found = 0;
 
   /* Find the glyph row with at least one position in the range
      [STARTPOS..ENDPOS), and the leftmost glyph in that row whose
@@ -24451,9 +24451,15 @@
 		dpyinfo->mouse_face_end_col = g - r->glyphs[TEXT_AREA];
 		dpyinfo->mouse_face_end_x = gx;
 	      }
+	    found = 1;
 	    break;
 	  }
-    }
+      if (found)
+	break;
+    }
+
+  if (!found)
+    return;
 
   /* Starting with the next row, look for the first row which does NOT
      include any glyphs whose positions are in the range.  */
@@ -24472,9 +24478,8 @@
       if (!found)
 	break;
     }
-
-  if (!found)
-    r--;
+  r--;
+
   dpyinfo->mouse_face_end_row = r - w->current_matrix->rows;
   dpyinfo->mouse_face_end_y = r->y;