From: Eli Zaretskii Date: Sat, 2 Oct 2010 17:42:53 +0000 (+0200) Subject: Fix beg_col calculation when painting from window start. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~511^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e1291a3605edf76f414c7f2919b02d714d41e827;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 61afecff203..25649a1a83b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/xdisp.c b/src/xdisp.c index 9e65d8f1bb0..eeea4cb4333 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23903,12 +23903,17 @@ mouse_face_from_buffer_pos (Lisp_Object window, 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 @@ mouse_face_from_buffer_pos (Lisp_Object window, 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 @@ mouse_face_from_buffer_pos (Lisp_Object window, 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. */