1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Fix bug #14476 with posn-at-point and glyphs from display vector.

src/xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a
 display vector, and we backtrack, handle the case that the
 previous character position is also displayed from a display
 vector or covered by a display string or image.
This commit is contained in:
Eli Zaretskii 2013-05-27 19:54:33 +03:00
parent 9f73bd1fe1
commit 6ef3db1043
2 changed files with 37 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2013-05-27 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a
display vector, and we backtrack, handle the case that the
previous character position is also displayed from a display
vector or covered by a display string or image. (Bug#14476)
2013-05-25 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove.

View File

@ -1371,18 +1371,41 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
top_x = it.glyph_row->x;
else
{
struct it it2;
struct it it2, it2_prev;
/* The idea is to get to the previous buffer
position, consume the character there, and use
the pixel coordinates we get after that. But if
the previous buffer position is also displayed
from a display vector, we need to consume all of
the glyphs from that display vector. */
start_display (&it2, w, top);
move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS);
get_next_display_element (&it2);
PRODUCE_GLYPHS (&it2);
if (ITERATOR_AT_END_OF_LINE_P (&it2)
|| it2.current_x > it2.last_visible_x)
/* If we didn't get to CHARPOS - 1, there's some
replacing display property at that position, and
we stopped after it. That is exactly the place
whose coordinates we want. */
if (IT_CHARPOS (it2) != charpos - 1)
it2_prev = it2;
else
{
/* Iterate until we get out of the display
vector that displays the character at
CHARPOS - 1. */
do {
get_next_display_element (&it2);
PRODUCE_GLYPHS (&it2);
it2_prev = it2;
set_iterator_to_next (&it2, 1);
} while (it2.method == GET_FROM_DISPLAY_VECTOR
&& IT_CHARPOS (it2) < charpos);
}
if (ITERATOR_AT_END_OF_LINE_P (&it2_prev)
|| it2_prev.current_x > it2_prev.last_visible_x)
top_x = it.glyph_row->x;
else
{
top_x = it2.current_x;
top_y = it2.current_y;
top_x = it2_prev.current_x;
top_y = it2_prev.current_y;
}
}
}