changeset 111108:d35341cade2a

Fix beg_col calculation when painting from window start. xdisp.c (mouse_face_from_buffer_pos): Don't compute beg_col if already decided to paint from beginning of window.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 02 Oct 2010 19:42:53 +0200
parents f3721a6253a8
children ee0f7585b521
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Oct 02 17:05:20 2010 +0200
+++ b/src/ChangeLog	Sat Oct 02 19:42:53 2010 +0200
@@ -12,7 +12,8 @@
 	(mouse_face_from_buffer_pos): Rewrite to not assume that
 	START_CHARPOS is always in mouse_face_beg_row.  If necessary, swap
 	mouse_face_beg_row and mouse_face_end_row so that the former is
-	always above the latter or identical to it.
+	always above the latter or identical to it.  Don't compute beg_col
+	if already decided to paint from beginning of window.
 
 2010-08-28  Eli Zaretskii  <eliz@gnu.org>
 
--- a/src/xdisp.c	Sat Oct 02 17:05:20 2010 +0200
+++ b/src/xdisp.c	Sat Oct 02 19:42:53 2010 +0200
@@ -23903,12 +23903,17 @@
   struct glyph *glyph, *end;
   EMACS_INT ignore, pos;
   int x;
+  int beg_set = 0;
 
   xassert (NILP (display_string) || STRINGP (display_string));
   xassert (NILP (before_string) || STRINGP (before_string));
   xassert (NILP (after_string) || STRINGP (after_string));
 
   /* Find the row with START_CHARPOS.  */
+  /* FIXME: Sometimes the caller gets "wise" and gives us the window
+     start position instead of the real start of the mouse face
+     property.  This completely messes up the logic of finding the
+     beg_row and end_row.  */
   if (start_charpos < MATRIX_ROW_START_CHARPOS (first)
       && (NILP (XBUFFER (w->buffer)->bidi_display_reordering)
 	  || row_containing_pos (w, start_charpos, first, NULL, 0) == NULL))
@@ -23917,6 +23922,7 @@
       dpyinfo->mouse_face_beg_row = MATRIX_ROW_VPOS (first, w->current_matrix);
       dpyinfo->mouse_face_beg_x = first->x;
       dpyinfo->mouse_face_beg_y = first->y;
+      beg_set = 1;
     }
   else
     {
@@ -23994,7 +24000,9 @@
      between START_CHARPOS and END_CHARPOS if the range of characters
      strides the bidi level boundary, e.g. if the beginning is in R2L
      text while the end is in L2R text or vice versa.  */
-  if (!r1->reversed_p)
+  if (beg_set)
+    ;
+  else if (!r1->reversed_p)
     {
       /* This row is in a left to right paragraph.  Scan it left to
 	 right.  */