Mercurial > emacs
changeset 111106:f8d92bb352b9
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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 02 Oct 2010 13:48:56 +0200 |
parents | 64a4bf2e92ae |
children | f3721a6253a8 |
files | src/ChangeLog src/xdisp.c |
diffstat | 2 files changed, 37 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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 <eliz@gnu.org> + + * 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 <eliz@gnu.org> * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as
--- 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;