diff options
| author | Eli Zaretskii | 2013-05-27 19:54:33 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-05-27 19:54:33 +0300 |
| commit | 6ef3db10430c653e302ca5983ade6f8eaa186f85 (patch) | |
| tree | c172409ff870018c970acb5751a503ca22b2cb0b /src | |
| parent | 9f73bd1fe11d79aef1498e94bb65055acc16f722 (diff) | |
| download | emacs-6ef3db10430c653e302ca5983ade6f8eaa186f85.tar.gz emacs-6ef3db10430c653e302ca5983ade6f8eaa186f85.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 37 |
2 files changed, 37 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5bcdb7ed068..b1f13e62b40 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-05-27 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (pos_visible_p): When CHARPOS is displayed frrom a | ||
| 4 | display vector, and we backtrack, handle the case that the | ||
| 5 | previous character position is also displayed from a display | ||
| 6 | vector or covered by a display string or image. (Bug#14476) | ||
| 7 | |||
| 1 | 2013-05-25 Jan Djärv <jan.h.d@swipnet.se> | 8 | 2013-05-25 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 9 | ||
| 3 | * xfns.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove. | 10 | * xfns.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove. |
diff --git a/src/xdisp.c b/src/xdisp.c index 5e92f3643c0..9f3be44ecfd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1371,18 +1371,41 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1371 | top_x = it.glyph_row->x; | 1371 | top_x = it.glyph_row->x; |
| 1372 | else | 1372 | else |
| 1373 | { | 1373 | { |
| 1374 | struct it it2; | 1374 | struct it it2, it2_prev; |
| 1375 | /* The idea is to get to the previous buffer | ||
| 1376 | position, consume the character there, and use | ||
| 1377 | the pixel coordinates we get after that. But if | ||
| 1378 | the previous buffer position is also displayed | ||
| 1379 | from a display vector, we need to consume all of | ||
| 1380 | the glyphs from that display vector. */ | ||
| 1375 | start_display (&it2, w, top); | 1381 | start_display (&it2, w, top); |
| 1376 | move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS); | 1382 | move_it_to (&it2, charpos - 1, -1, -1, -1, MOVE_TO_POS); |
| 1377 | get_next_display_element (&it2); | 1383 | /* If we didn't get to CHARPOS - 1, there's some |
| 1378 | PRODUCE_GLYPHS (&it2); | 1384 | replacing display property at that position, and |
| 1379 | if (ITERATOR_AT_END_OF_LINE_P (&it2) | 1385 | we stopped after it. That is exactly the place |
| 1380 | || it2.current_x > it2.last_visible_x) | 1386 | whose coordinates we want. */ |
| 1387 | if (IT_CHARPOS (it2) != charpos - 1) | ||
| 1388 | it2_prev = it2; | ||
| 1389 | else | ||
| 1390 | { | ||
| 1391 | /* Iterate until we get out of the display | ||
| 1392 | vector that displays the character at | ||
| 1393 | CHARPOS - 1. */ | ||
| 1394 | do { | ||
| 1395 | get_next_display_element (&it2); | ||
| 1396 | PRODUCE_GLYPHS (&it2); | ||
| 1397 | it2_prev = it2; | ||
| 1398 | set_iterator_to_next (&it2, 1); | ||
| 1399 | } while (it2.method == GET_FROM_DISPLAY_VECTOR | ||
| 1400 | && IT_CHARPOS (it2) < charpos); | ||
| 1401 | } | ||
| 1402 | if (ITERATOR_AT_END_OF_LINE_P (&it2_prev) | ||
| 1403 | || it2_prev.current_x > it2_prev.last_visible_x) | ||
| 1381 | top_x = it.glyph_row->x; | 1404 | top_x = it.glyph_row->x; |
| 1382 | else | 1405 | else |
| 1383 | { | 1406 | { |
| 1384 | top_x = it2.current_x; | 1407 | top_x = it2_prev.current_x; |
| 1385 | top_y = it2.current_y; | 1408 | top_y = it2_prev.current_y; |
| 1386 | } | 1409 | } |
| 1387 | } | 1410 | } |
| 1388 | } | 1411 | } |