diff options
author | Eli Zaretskii <eliz@gnu.org> | 2010-10-02 13:48:56 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2010-10-02 13:48:56 +0200 |
commit | 12d54c2e095dee28d8829c93d14ae18f92f474fb (patch) | |
tree | 75005a58457b7c13762ab5db66f99ebba7838243 /src | |
parent | 1b5a721bd5135792fface8df3849c3c42d4ca2c5 (diff) | |
download | emacs-12d54c2e095dee28d8829c93d14ae18f92f474fb.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/xdisp.c | 38 |
2 files changed, 36 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b846070b922..2b77f081f52 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/xdisp.c b/src/xdisp.c index 40ba72a18bc..e19c26cbc19 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -23832,20 +23832,30 @@ coords_in_mouse_face_p (struct window *w, int hpos, int vpos) && vpos < dpyinfo->mouse_face_end_row) return 1; - if (MATRIX_ROW (w->current_matrix, vpos)->reversed_p) + 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 (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 @@ note_mouse_highlight (struct frame *f, int x, int y) /* 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; |