# HG changeset patch # User Eli Zaretskii # Date 1287836908 -7200 # Node ID 3f3a9d92dcbe34837d1144dd92103eff6de222a7 # Parent 28595721f736f091f5ce98c2f951452ad437bfcf 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. diff -r 28595721f736 -r 3f3a9d92dcbe src/ChangeLog --- 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 + + * 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 * xdisp.c (fast_find_string_pos): #ifdef away, not used anymore. diff -r 28595721f736 -r 3f3a9d92dcbe src/xdisp.c --- 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;