# HG changeset patch # User Eli Zaretskii # Date 1286020136 -7200 # Node ID f8d92bb352b9caee271148ebdcab2389682f8f31 # Parent 64a4bf2e92aee034ecf102d9be230ed27c8df61f Fix minor bugs in mouse highlight. xdisp.c (coords_in_mouse_face_p): Fix the conditions for when mouse_face_beg_row and mouse_face_end_row are equal. (note_mouse_highlight): Clear mouse highlight when mouse pointer is in a R2L row on the stretch glyph that stands for no text beyond the line end. diff -r 64a4bf2e92ae -r f8d92bb352b9 src/ChangeLog --- a/src/ChangeLog Sat Aug 28 18:23:10 2010 +0300 +++ b/src/ChangeLog Sat Oct 02 13:48:56 2010 +0200 @@ -1,3 +1,11 @@ +2010-10-02 Eli Zaretskii + + * xdisp.c (coords_in_mouse_face_p): Fix the conditions for when + mouse_face_beg_row and mouse_face_end_row are equal. + (note_mouse_highlight): Clear mouse highlight when mouse pointer + is in a R2L row on the stretch glyph that stands for no text + beyond the line end. + 2010-08-28 Eli Zaretskii * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as diff -r 64a4bf2e92ae -r f8d92bb352b9 src/xdisp.c --- a/src/xdisp.c Sat Aug 28 18:23:10 2010 +0300 +++ b/src/xdisp.c Sat Oct 02 13:48:56 2010 +0200 @@ -23832,20 +23832,30 @@ && vpos < dpyinfo->mouse_face_end_row) return 1; - if (MATRIX_ROW (w->current_matrix, vpos)->reversed_p) - { - if ((vpos == dpyinfo->mouse_face_beg_row - && hpos <= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos > dpyinfo->mouse_face_end_col)) + if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p) + { + if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + { + if (dpyinfo->mouse_face_beg_col <= hpos && hpos < dpyinfo->mouse_face_end_col) + return 1; + } + else if ((vpos == dpyinfo->mouse_face_beg_row + && hpos >= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos < dpyinfo->mouse_face_end_col)) return 1; } else { - if ((vpos == dpyinfo->mouse_face_beg_row - && hpos >= dpyinfo->mouse_face_beg_col) - || (vpos == dpyinfo->mouse_face_end_row - && hpos < dpyinfo->mouse_face_end_col)) + if (dpyinfo->mouse_face_beg_row == dpyinfo->mouse_face_end_row) + { + if (dpyinfo->mouse_face_end_col < hpos && hpos <= dpyinfo->mouse_face_beg_col) + return 1; + } + else if ((vpos == dpyinfo->mouse_face_beg_row + && hpos <= dpyinfo->mouse_face_beg_col) + || (vpos == dpyinfo->mouse_face_end_row + && hpos > dpyinfo->mouse_face_end_col)) return 1; } return 0; @@ -24846,7 +24856,15 @@ /* Clear mouse face if X/Y not over text. */ if (glyph == NULL || area != TEXT_AREA - || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p) + || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p + /* R2L rows have a stretch glyph at their front, which + stands for no text, whereas L2R rows have no glyphs at + all beyond the end of text. Treat such stretch glyphs as + NULL glyphs in L2R rows. */ + || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p + && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA] + && glyph->type == STRETCH_GLYPH + && glyph->avoid_cursor_p)) { if (clear_mouse_face (dpyinfo)) cursor = No_Cursor;