diff options
| author | Eli Zaretskii | 2010-08-28 15:36:19 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-08-28 15:36:19 +0300 |
| commit | 5f53c454dcb80c500dca29845438f63e45bf7412 (patch) | |
| tree | 208b9a7de7774649adc307e7710654308bf2493d /src | |
| parent | 3e61caebcf490a3d99f50221aed1f11c6bcfdcd7 (diff) | |
| download | emacs-5f53c454dcb80c500dca29845438f63e45bf7412.tar.gz emacs-5f53c454dcb80c500dca29845438f63e45bf7412.zip | |
Support L2R continued lines.
xdisp.c (mouse_face_from_buffer_pos): Fix the case of continued L2R lines.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 52 |
2 files changed, 45 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 01dc3dfb305..7444c76d91c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | 2010-08-28 Eli Zaretskii <eliz@gnu.org> | 1 | 2010-08-28 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 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. | 4 | test case. Implement highlight for R2L rows. Fix the case of |
| 5 | continued L2R lines. | ||
| 5 | 6 | ||
| 6 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> | 7 | 2010-08-21 Eli Zaretskii <eliz@gnu.org> |
| 7 | 8 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 296fe5d2c59..92d3dbea319 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -23837,7 +23837,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 23837 | { | 23837 | { |
| 23838 | struct window *w = XWINDOW (window); | 23838 | struct window *w = XWINDOW (window); |
| 23839 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 23839 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 23840 | struct glyph_row *row; | 23840 | struct glyph_row *row, *r; |
| 23841 | struct glyph *glyph, *end; | 23841 | struct glyph *glyph, *end; |
| 23842 | EMACS_INT ignore, pos; | 23842 | EMACS_INT ignore, pos; |
| 23843 | int x; | 23843 | int x; |
| @@ -24016,10 +24016,10 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24016 | } | 24016 | } |
| 24017 | 24017 | ||
| 24018 | /* Find the last highlighted glyph. */ | 24018 | /* Find the last highlighted glyph. */ |
| 24019 | row = row_containing_pos (w, end_charpos, first, NULL, 0); | 24019 | r = row_containing_pos (w, end_charpos, first, NULL, 0); |
| 24020 | if (row == NULL) | 24020 | if (r == NULL) |
| 24021 | { | 24021 | { |
| 24022 | row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 24022 | r = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); |
| 24023 | dpyinfo->mouse_face_past_end = 1; | 24023 | dpyinfo->mouse_face_past_end = 1; |
| 24024 | } | 24024 | } |
| 24025 | else if (!NILP (after_string)) | 24025 | else if (!NILP (after_string)) |
| @@ -24029,12 +24029,37 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24029 | struct glyph_row *last | 24029 | struct glyph_row *last |
| 24030 | = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); | 24030 | = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); |
| 24031 | 24031 | ||
| 24032 | for (next = row + 1; | 24032 | for (next = r + 1; |
| 24033 | next <= last | 24033 | next <= last |
| 24034 | && next->used[TEXT_AREA] > 0 | 24034 | && next->used[TEXT_AREA] > 0 |
| 24035 | && EQ (next->glyphs[TEXT_AREA]->object, after_string); | 24035 | && EQ (next->glyphs[TEXT_AREA]->object, after_string); |
| 24036 | ++next) | 24036 | ++next) |
| 24037 | row = next; | 24037 | r = next; |
| 24038 | } | ||
| 24039 | |||
| 24040 | /* If the highlight ends in a different row, compute GLYPH and END | ||
| 24041 | for the end row. */ | ||
| 24042 | if (r != row) | ||
| 24043 | { | ||
| 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) | ||
| 24052 | { | ||
| 24053 | glyph = r->glyphs[TEXT_AREA]; | ||
| 24054 | end = glyph + r->used[TEXT_AREA]; | ||
| 24055 | x = r->x; | ||
| 24056 | } | ||
| 24057 | else | ||
| 24058 | { | ||
| 24059 | end = r->glyphs[TEXT_AREA] - 1; | ||
| 24060 | glyph = end + r->used[TEXT_AREA]; | ||
| 24061 | } | ||
| 24062 | row = r; | ||
| 24038 | } | 24063 | } |
| 24039 | 24064 | ||
| 24040 | dpyinfo->mouse_face_end_y = row->y; | 24065 | dpyinfo->mouse_face_end_y = row->y; |
| @@ -24130,9 +24155,18 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24130 | x += end->pixel_width; | 24155 | x += end->pixel_width; |
| 24131 | } | 24156 | } |
| 24132 | /* In the left-to-right screen geometry, END is actually the | 24157 | /* In the left-to-right screen geometry, END is actually the |
| 24133 | _beginning_ of the highlighted area for R2L paragraphs. */ | 24158 | _beginning_ of the highlighted area for R2L paragraphs, if |
| 24134 | dpyinfo->mouse_face_beg_x = x; | 24159 | the highlight begins and ends in the same row. */ |
| 24135 | dpyinfo->mouse_face_beg_col = end - row->glyphs[TEXT_AREA]; | 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 | } | ||
| 24136 | } | 24170 | } |
| 24137 | 24171 | ||
| 24138 | dpyinfo->mouse_face_window = window; | 24172 | dpyinfo->mouse_face_window = window; |