diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/xdisp.c | 74 |
2 files changed, 44 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7444c76d91c..ee13b6a4b35 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as | 3 | * xdisp.c (mouse_face_from_buffer_pos): Fix code using bug#1220 as |
| 4 | test case. Implement highlight for R2L rows. Fix the case of | 4 | test case. Implement highlight for R2L rows. Fix the case of |
| 5 | continued L2R lines. | 5 | continued L2R lines. |
| 6 | (show_mouse_face): Support drawing highlighted R2L lines. | ||
| 6 | 7 | ||
| 7 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> | 8 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> |
| 8 | 9 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 92d3dbea319..3a99435123a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -23711,8 +23711,30 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23711 | /* For all but the first row, the highlight starts at column 0. */ | 23711 | /* For all but the first row, the highlight starts at column 0. */ |
| 23712 | if (row == first) | 23712 | if (row == first) |
| 23713 | { | 23713 | { |
| 23714 | start_hpos = dpyinfo->mouse_face_beg_col; | 23714 | /* R2L rows have BEG and END in reversed order, but the |
| 23715 | start_x = dpyinfo->mouse_face_beg_x; | 23715 | screen drawing geometry is always left to right. So |
| 23716 | we need to mirror the beginning and end of the | ||
| 23717 | highlighted area in R2L rows. */ | ||
| 23718 | if (!row->reversed_p) | ||
| 23719 | { | ||
| 23720 | start_hpos = dpyinfo->mouse_face_beg_col; | ||
| 23721 | start_x = dpyinfo->mouse_face_beg_x; | ||
| 23722 | } | ||
| 23723 | else if (row == last) | ||
| 23724 | { | ||
| 23725 | start_hpos = dpyinfo->mouse_face_end_col; | ||
| 23726 | start_x = dpyinfo->mouse_face_end_x; | ||
| 23727 | } | ||
| 23728 | else | ||
| 23729 | { | ||
| 23730 | start_hpos = 0; | ||
| 23731 | start_x = 0; | ||
| 23732 | } | ||
| 23733 | } | ||
| 23734 | else if (row->reversed_p && row == last) | ||
| 23735 | { | ||
| 23736 | start_hpos = dpyinfo->mouse_face_end_col; | ||
| 23737 | start_x = dpyinfo->mouse_face_end_x; | ||
| 23716 | } | 23738 | } |
| 23717 | else | 23739 | else |
| 23718 | { | 23740 | { |
| @@ -23721,7 +23743,20 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23721 | } | 23743 | } |
| 23722 | 23744 | ||
| 23723 | if (row == last) | 23745 | if (row == last) |
| 23724 | end_hpos = dpyinfo->mouse_face_end_col; | 23746 | { |
| 23747 | if (!row->reversed_p) | ||
| 23748 | end_hpos = dpyinfo->mouse_face_end_col; | ||
| 23749 | else if (row == first) | ||
| 23750 | end_hpos = dpyinfo->mouse_face_beg_col; | ||
| 23751 | else | ||
| 23752 | { | ||
| 23753 | end_hpos = row->used[TEXT_AREA]; | ||
| 23754 | if (draw == DRAW_NORMAL_TEXT) | ||
| 23755 | row->fill_line_p = 1; /* Clear to end of line */ | ||
| 23756 | } | ||
| 23757 | } | ||
| 23758 | else if (row->reversed_p && row == first) | ||
| 23759 | end_hpos = dpyinfo->mouse_face_beg_col; | ||
| 23725 | else | 23760 | else |
| 23726 | { | 23761 | { |
| 23727 | end_hpos = row->used[TEXT_AREA]; | 23762 | end_hpos = row->used[TEXT_AREA]; |
| @@ -24002,16 +24037,11 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24002 | } | 24037 | } |
| 24003 | } | 24038 | } |
| 24004 | 24039 | ||
| 24005 | /* Mouse highlight uses the screen geometry, which is left | 24040 | glyph++; /* first glyph to the right of the highlighted area */ |
| 24006 | to right even in R2L paragraphs. Therefore, for R2L | ||
| 24007 | paragraphs, the "first" highlighted glyph actually | ||
| 24008 | determines the _end_ column and x of the highlighted | ||
| 24009 | area. */ | ||
| 24010 | glyph++; /* first glyph beyond the highlighted area */ | ||
| 24011 | for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) | 24041 | for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) |
| 24012 | x += g->pixel_width; | 24042 | x += g->pixel_width; |
| 24013 | dpyinfo->mouse_face_end_x = x; | 24043 | dpyinfo->mouse_face_beg_x = x; |
| 24014 | dpyinfo->mouse_face_end_col = glyph - row->glyphs[TEXT_AREA]; | 24044 | dpyinfo->mouse_face_beg_col = glyph - row->glyphs[TEXT_AREA]; |
| 24015 | } | 24045 | } |
| 24016 | } | 24046 | } |
| 24017 | 24047 | ||
| @@ -24041,13 +24071,6 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24041 | for the end row. */ | 24071 | for the end row. */ |
| 24042 | if (r != row) | 24072 | if (r != row) |
| 24043 | { | 24073 | { |
| 24044 | /* If the beginning row was an R2L row, we actually computed | ||
| 24045 | above the beginning of the highlighted area, not its end. */ | ||
| 24046 | if (row->reversed_p) | ||
| 24047 | { | ||
| 24048 | dpyinfo->mouse_face_beg_x = dpyinfo->mouse_face_end_x; | ||
| 24049 | dpyinfo->mouse_face_beg_col = dpyinfo->mouse_face_end_col; | ||
| 24050 | } | ||
| 24051 | if (!r->reversed_p) | 24074 | if (!r->reversed_p) |
| 24052 | { | 24075 | { |
| 24053 | glyph = r->glyphs[TEXT_AREA]; | 24076 | glyph = r->glyphs[TEXT_AREA]; |
| @@ -24154,19 +24177,8 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24154 | } | 24177 | } |
| 24155 | x += end->pixel_width; | 24178 | x += end->pixel_width; |
| 24156 | } | 24179 | } |
| 24157 | /* In the left-to-right screen geometry, END is actually the | 24180 | dpyinfo->mouse_face_end_x = x; |
| 24158 | _beginning_ of the highlighted area for R2L paragraphs, if | 24181 | dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; |
| 24159 | the highlight begins and ends in the same row. */ | ||
| 24160 | if (dpyinfo->mouse_face_end_row == dpyinfo->mouse_face_beg_row) | ||
| 24161 | { | ||
| 24162 | dpyinfo->mouse_face_beg_x = x; | ||
| 24163 | dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; | ||
| 24164 | } | ||
| 24165 | else | ||
| 24166 | { | ||
| 24167 | dpyinfo->mouse_face_end_x = x; | ||
| 24168 | dpyinfo->mouse_face_end_col = end - row->glyphs[TEXT_AREA]; | ||
| 24169 | } | ||
| 24170 | } | 24182 | } |
| 24171 | 24183 | ||
| 24172 | dpyinfo->mouse_face_window = window; | 24184 | dpyinfo->mouse_face_window = window; |