diff options
| author | Eli Zaretskii | 2013-09-23 12:18:38 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-23 12:18:38 +0300 |
| commit | f03eddbff64da3a9304b2c654b6f46b58f318787 (patch) | |
| tree | c0a6b7c7606ec49ca08f14b386ccb79907011d65 /src | |
| parent | cd548fa41b9d298bea8e09b57655e20887d2e922 (diff) | |
| download | emacs-f03eddbff64da3a9304b2c654b6f46b58f318787.tar.gz emacs-f03eddbff64da3a9304b2c654b6f46b58f318787.zip | |
Fix bug #15437 with mouse highlight on overlay strings.
src/xdisp.c (mouse_face_from_string_pos): Fix off-by-one error in
computing the end column of mouse-highlight that comes from
display or overlay strings.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 093368568c2..8483bdc6216 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2013-09-23 Eli Zaretskii <eliz@gnu.org> | 1 | 2013-09-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (mouse_face_from_string_pos): Fix off-by-one error in | ||
| 4 | computing the end column of mouse-highlight that comes from | ||
| 5 | display or overlay strings. (Bug#15437) | ||
| 6 | |||
| 3 | * conf_post.h (__has_builtin): Define to zero, if undefined, on | 7 | * conf_post.h (__has_builtin): Define to zero, if undefined, on |
| 4 | all platforms, not just for clang. | 8 | all platforms, not just for clang. |
| 5 | 9 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index bfd86758a1e..0575c7b3282 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -27381,7 +27381,7 @@ fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object, | |||
| 27381 | #endif /* not used */ | 27381 | #endif /* not used */ |
| 27382 | 27382 | ||
| 27383 | /* Find the positions of the first and the last glyphs in window W's | 27383 | /* Find the positions of the first and the last glyphs in window W's |
| 27384 | current matrix that occlude positions [STARTPOS..ENDPOS] in OBJECT | 27384 | current matrix that occlude positions [STARTPOS..ENDPOS) in OBJECT |
| 27385 | (assumed to be a string), and return in HLINFO's mouse_face_* | 27385 | (assumed to be a string), and return in HLINFO's mouse_face_* |
| 27386 | members the pixel and column/row coordinates of those glyphs. */ | 27386 | members the pixel and column/row coordinates of those glyphs. */ |
| 27387 | 27387 | ||
| @@ -27397,7 +27397,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27397 | int found = 0; | 27397 | int found = 0; |
| 27398 | 27398 | ||
| 27399 | /* Find the glyph row with at least one position in the range | 27399 | /* Find the glyph row with at least one position in the range |
| 27400 | [STARTPOS..ENDPOS], and the first glyph in that row whose | 27400 | [STARTPOS..ENDPOS), and the first glyph in that row whose |
| 27401 | position belongs to that range. */ | 27401 | position belongs to that range. */ |
| 27402 | for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 27402 | for (r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 27403 | r->enabled_p && r->y < yb; | 27403 | r->enabled_p && r->y < yb; |
| @@ -27409,7 +27409,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27409 | e = g + r->used[TEXT_AREA]; | 27409 | e = g + r->used[TEXT_AREA]; |
| 27410 | for (gx = r->x; g < e; gx += g->pixel_width, ++g) | 27410 | for (gx = r->x; g < e; gx += g->pixel_width, ++g) |
| 27411 | if (EQ (g->object, object) | 27411 | if (EQ (g->object, object) |
| 27412 | && startpos <= g->charpos && g->charpos <= endpos) | 27412 | && startpos <= g->charpos && g->charpos < endpos) |
| 27413 | { | 27413 | { |
| 27414 | hlinfo->mouse_face_beg_row | 27414 | hlinfo->mouse_face_beg_row |
| 27415 | = MATRIX_ROW_VPOS (r, w->current_matrix); | 27415 | = MATRIX_ROW_VPOS (r, w->current_matrix); |
| @@ -27427,7 +27427,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27427 | g = e + r->used[TEXT_AREA]; | 27427 | g = e + r->used[TEXT_AREA]; |
| 27428 | for ( ; g > e; --g) | 27428 | for ( ; g > e; --g) |
| 27429 | if (EQ ((g-1)->object, object) | 27429 | if (EQ ((g-1)->object, object) |
| 27430 | && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) | 27430 | && startpos <= (g-1)->charpos && (g-1)->charpos < endpos) |
| 27431 | { | 27431 | { |
| 27432 | hlinfo->mouse_face_beg_row | 27432 | hlinfo->mouse_face_beg_row |
| 27433 | = MATRIX_ROW_VPOS (r, w->current_matrix); | 27433 | = MATRIX_ROW_VPOS (r, w->current_matrix); |
| @@ -27455,7 +27455,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27455 | found = 0; | 27455 | found = 0; |
| 27456 | for ( ; g < e; ++g) | 27456 | for ( ; g < e; ++g) |
| 27457 | if (EQ (g->object, object) | 27457 | if (EQ (g->object, object) |
| 27458 | && startpos <= g->charpos && g->charpos <= endpos) | 27458 | && startpos <= g->charpos && g->charpos < endpos) |
| 27459 | { | 27459 | { |
| 27460 | found = 1; | 27460 | found = 1; |
| 27461 | break; | 27461 | break; |
| @@ -27478,7 +27478,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27478 | e = g + r->used[TEXT_AREA]; | 27478 | e = g + r->used[TEXT_AREA]; |
| 27479 | for ( ; e > g; --e) | 27479 | for ( ; e > g; --e) |
| 27480 | if (EQ ((e-1)->object, object) | 27480 | if (EQ ((e-1)->object, object) |
| 27481 | && startpos <= (e-1)->charpos && (e-1)->charpos <= endpos) | 27481 | && startpos <= (e-1)->charpos && (e-1)->charpos < endpos) |
| 27482 | break; | 27482 | break; |
| 27483 | hlinfo->mouse_face_end_col = e - g; | 27483 | hlinfo->mouse_face_end_col = e - g; |
| 27484 | 27484 | ||
| @@ -27493,7 +27493,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | |||
| 27493 | for (gx = r->x ; e < g; ++e) | 27493 | for (gx = r->x ; e < g; ++e) |
| 27494 | { | 27494 | { |
| 27495 | if (EQ (e->object, object) | 27495 | if (EQ (e->object, object) |
| 27496 | && startpos <= e->charpos && e->charpos <= endpos) | 27496 | && startpos <= e->charpos && e->charpos < endpos) |
| 27497 | break; | 27497 | break; |
| 27498 | gx += e->pixel_width; | 27498 | gx += e->pixel_width; |
| 27499 | } | 27499 | } |